Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

COPY query

May
64
0
I hope the below are self-explanatory.
What am I not understanding about the copy command?
Is *2* "erroring out" (without error message) when the first sub-directory has nothing to copy?
Is so why no equivalent of /I in global?
How do I do what I want (copy all xxx*.* files from the tree, not creating empty directories)?

- Yakir

TCC 13.03.38 x64 Windows 7 [Version 6.1.7601]
(I get the same with ver. 12 on a different machine)

** 1 **
C:\yhWork\test-> dir /s/f/h
C:\yhWork\test\test01
C:\yhWork\test\test02
C:\yhWork\test\test01\ppp.qqq
C:\yhWork\test\test01\xxx.txt
C:\yhWork\test\test01\xxx2.txt
C:\yhWork\test\test02\yyy.zzz

C:\yhWork\test-> copy /s/f xxx*.* ..\test2
TCC: (Sys) The system cannot find the file specified.
"C:\yhWork\test\xxx*.*"
C:\yhWork\test\test01\xxx.txt => C:\yhWork\test2\test01\xxx.txt
C:\yhWork\test\test01\xxx2.txt => C:\yhWork\test2\test01\xxx2.txt
2 files copied

** 2 **
C:\yhWork\test-> dir /s/f/h
C:\yhWork\test\test01
C:\yhWork\test\test02
C:\yhWork\test\test01\ppp.qqq
C:\yhWork\test\test02\xxx.txt
C:\yhWork\test\test02\xxx2.txt
C:\yhWork\test\test02\yyy.zzz

C:\yhWork\test-> copy /s/f xxx*.* ..\test2
0 files copied
 
Use the /e or in later versions the /ne option to suppress warning messages when you asked the command to process files that it cannot find.
 
If anything I have too few (!) error messages.
The /E does not make any difference.

Do others get the same results?
 
Maybe I should have been specific ;-(
The problem is in case *2* when no files are copied. Case *1* is OK!
 
The problem is in case *2* when no files are copied. Case *1* is OK!
That seems impossible UNLESS your "copy" command is an alias! No character that is legal in a filename is treated specially by TCC or by the Windows API it uses to copy.

I tested your command (using *copy to avoid biasing results by my COPY alias, below) on my system and it performed exactly as I expected. Without /e it warned that a specific directory had no files to copy, no error (warning) messages with /e. It copied all that matched. Tested with xxx*.*, xxx*1*.* and xxx*2*.* (always making the target directory empty before the test). In all instances the target directory contained exactly what I expected and what COPY reported. I

FYI, I do use an alias:
copy is an alias : *copy/[!descript.ion]/efgrhv/netj/j
where there is a redundancy: both /e and /ne are present, both have the same effect (historic reasons: older versions had only /e).
 
Thanks for the feedback.

copy is not aliased

Here is how I set up the test:
> md test01
> md test02
then I copied some files into test01, including xxx*.* files
then I copied some files into test02, NOT including xxx*.* files
*1*: ran the copy command ==> all OK

Then copied the xxx*.* files manually from test01 to test02:
*2*: ran the copy command ==> 0 files copied !

i.e. it works if there are relevant file in the first (?!) directory, but not if there aren't


Just tried a further test, added test03

** 3**
C:\yhWork\test-> dir /s/f/h
C:\yhWork\test\test01
C:\yhWork\test\test02
C:\yhWork\test\test03
C:\yhWork\test\test01\ppp.qqq
C:\yhWork\test\test01\xxx.txt
C:\yhWork\test\test01\xxx2.txt
C:\yhWork\test\test02\yyy.zzz
C:\yhWork\test\test03\xxx1.txt

C:\yhWork\test-> copy /s/f/e XX*.* ..\test2
C:\yhWork\test\test01\xxx.txt => C:\yhWork\test2\test01\xxx.txt
C:\yhWork\test\test01\xxx2.txt => C:\yhWork\test2\test01\xxx2.txt
C:\yhWork\test\test03\xxx1.txt => C:\yhWork\test2\test03\xxx1.txt
3 files copied

** 4 **
C:\yhWork\test-> dir /s/f/h
C:\yhWork\test\test01
C:\yhWork\test\test02
C:\yhWork\test\test03
C:\yhWork\test\test01\ppp.qqq
C:\yhWork\test\test02\xxx.txt
C:\yhWork\test\test02\xxx2.txt
C:\yhWork\test\test02\yyy.zzz
C:\yhWork\test\test03\xxx1.txt

C:\yhWork\test-> copy /s/f/e XX*.* ..\test2
0 files copied !!!!!!!!!!!!!!!
(there goes my theory that the empty dir is "erroring out")

This is looking more and more like a case where I will slap my forehead when I see what is happening :-(
 
C:\yhWork\test-> attrib /d test02
____D_________ C:\yhWork\test\test02

C:\yhWork\test-> attrib /d test01
____D_________ C:\yhWork\test\test01
 
I couldn't reproduce this the first couple of times I tried it, but after trying on a couple of other machines I was eventually able to recreate it. It turns out to be a Windows API (I can only reproduce it on Win7 x64 so far) that's behaving erratically, albeit in a fashion that's somewhat murky in the documentation.

At any rate, I have a workaround for 13.03.39, which I will upload in the next day.
 
Back
Top
[FOX] Ultimate Translator
Translate