Jump to content











Photo
- - - - -

Interesting FileCopy Feature


  • Please log in to reply
6 replies to this topic

#1 oriensol

oriensol

    Frequent Member

  • Advanced user
  • 216 posts
  •  
    India

Posted 15 October 2009 - 08:49 AM

Looks like FileCopy copies extra files under certain circumstances.

Here's an example:

Run this in CodeBox:

FileCopy,"D:\TestInput\testfile.*","D:\TestOutput"

with the content of D:\TestInput being:

d:

cd TestInput

dir /s *

Volume in drive D is WORK

Volume Serial Number is 40C5-6EEB



Directory of D:\TestInput



10/15/2009  01&#58;44 PM	<DIR>		  .

10/15/2009  01&#58;44 PM	<DIR>		  ..

10/15/2009  01&#58;30 PM	<DIR>		  junk

10/15/2009  01&#58;29 PM				 0 testfile.txt

			   1 File&#40;s&#41;			  0 bytes



Directory of D&#58;\TestInput\junk



10/15/2009  01&#58;30 PM	<DIR>		  .

10/15/2009  01&#58;30 PM	<DIR>		  ..

10/15/2009  01&#58;30 PM	<DIR>		  junk

10/15/2009  01&#58;29 PM				 0 testfile.txt

			   1 File&#40;s&#41;			  0 bytes



Directory of D&#58;\TestInput\junk\junk



10/15/2009  01&#58;30 PM	<DIR>		  .

10/15/2009  01&#58;30 PM	<DIR>		  ..

10/15/2009  01&#58;29 PM				 0 testfile.txt

			   1 File&#40;s&#41;			  0 bytes



	 Total Files Listed&#58;

			   3 File&#40;s&#41;			  0 bytes

			   8 Dir&#40;s&#41;   1,742,062,592 bytes free

You will get the output (with both 77RC2 and 78SP2):

d&#58;

cd TestOutput

dir /s *

Volume in drive D is WORK

Volume Serial Number is 40C5-6EEB

 

Directory of D&#58;\TestOutput



10/15/2009  01&#58;44 PM	<DIR>		  .

10/15/2009  01&#58;44 PM	<DIR>		  ..

10/15/2009  01&#58;43 PM	<DIR>		  junk

10/15/2009  01&#58;29 PM				 0 testfile.txt

			   1 File&#40;s&#41;			  0 bytes

 

Directory of D&#58;\TestOutput\junk



10/15/2009  01&#58;43 PM	<DIR>		  .

10/15/2009  01&#58;43 PM	<DIR>		  ..

10/15/2009  01&#58;43 PM	<DIR>		  junk

10/15/2009  01&#58;29 PM				 0 testfile.txt

			   1 File&#40;s&#41;			  0 bytes

 

Directory of D&#58;\TestOutput\junk\junk



10/15/2009  01&#58;43 PM	<DIR>		  .

10/15/2009  01&#58;43 PM	<DIR>		  ..

10/15/2009  01&#58;29 PM				 0 testfile.txt

			   1 File&#40;s&#41;			  0 bytes



	 Total Files Listed&#58;

			   3 File&#40;s&#41;			  0 bytes

			   8 Dir&#40;s&#41;   1,742,061,568 bytes free

whereas, I would have expected to see ONLY ONE (testfile.txt) file in D:\TestOutput.

FileCopy seems to be copying all files that match the filename within subdirectories also - seems to be something to do with the use of '*'.

Thanks.

#2 paraglider

paraglider

    Gold Member

  • .script developer
  • 1743 posts
  • Location:NC,USA
  •  
    United States

Posted 15 October 2009 - 11:19 AM

Both directory lists look the same to me

#3 was_jaclaz

was_jaclaz

    Finder

  • Advanced user
  • 7101 posts
  • Location:Gone in the mist
  •  
    Italy

Posted 15 October 2009 - 11:57 AM

Both directory lists look the same to me


They ARE the same.

Point is if that should be the effect of the command:
FileCopy,&#34;D&#58;\TestInput\testfile.*&#34;,&#34;D&#58;\TestOutput&#34;

what oriensol expected was a result like this:

d&#58;

cd TestOutput

dir /s *

Volume in drive D is WORK

Volume Serial Number is 40C5-6EEB



Directory of D&#58;\TestOutput



10/15/2009  01&#58;44 PM	<DIR>		  .

10/15/2009  01&#58;44 PM	<DIR>		  ..

10/15/2009  01&#58;29 PM				 0 testfile.txt

			   1 File&#40;s&#41;			  0 bytes
WITHOUT the creation of the /junk and /junk/junk subdirectories AND files in them.

jaclaz

#4 Lancelot

Lancelot

    Frequent Member

  • .script developer
  • 5013 posts
  • Location:Turkiye/Izmir
  • Interests:*Mechanical stuff and Physics,
    *LiveXP, BartPE, SherpyaXPE,
    *Basketball and Looong Walking,
    *Buying outwear for my girlf (Reason: Girls are stupid about buying bad stuff to make themselves uglier :))
    *Girls (Lyric: Girl,...., You will be a womann, Soon)
    *Answering questions for "Meaning of life",
    *Helping people,

    Kung with LiveXP, Fu with Peter :)
  •  
    Turkey

Posted 15 October 2009 - 12:20 PM

FileCopy,&#34;D&#58;\TestInput\testfile.*&#34;,&#34;D&#58;\TestOutput&#34;
.............
whereas, I would have expected to see ONLY ONE (testfile.txt) file in D:\TestOutput.


I guess you should use
FileCopy,&#34;D&#58;\TestInput\testfile.*&#34;,&#34;D&#58;\TestOutput&#34;,NOREC

FileCopy seems to be copying all files that match the filename within subdirectories also - seems to be something to do with the use of '*'.

for backward compatibility wildcards copy recursive

check
http://winbuilder.ne...x.html#FileCopy

#5 oriensol

oriensol

    Frequent Member

  • Advanced user
  • 216 posts
  •  
    India

Posted 15 October 2009 - 01:06 PM

Thanks Lancelot. I wasn't aware of the functionality - did not seem obvious.

#6 was_jaclaz

was_jaclaz

    Finder

  • Advanced user
  • 7101 posts
  • Location:Gone in the mist
  •  
    Italy

Posted 15 October 2009 - 02:40 PM

Case solved.

Thread renamed.

NOT a bug, it is by design :lol:.

:lol:

jaclaz

#7 paraglider

paraglider

    Gold Member

  • .script developer
  • 1743 posts
  • Location:NC,USA
  •  
    United States

Posted 16 October 2009 - 03:50 AM

The behavior of FileCopy is fully documented here:

http://winbuilder.ne...x.html#FileCopy




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users