Link to home
Start Free TrialLog in
Avatar of joelsilva
joelsilva

asked on

Need HELP right now (i am in a customer) - DOS question ppl.

Hi folks,

I need help right now.

There are some subdirectories in my c:\concentrador\cupom\. I need to move files from these subdirectories into my directory c:\contas\... But i am having trouble because when i use XCOPY the subdirectories come together with these files... I just need the FILES and not the SUBDIRECTORES\the files... I tried MOVE command but it doesnt understand that i need search all subdirectories in c:\concentrador\cupom\ (it just search for files in c:\concentrador\cupom\).

Sorry for not to be a DELPHI question but i just can get help here.

Best regards.
ASKER CERTIFIED SOLUTION
Avatar of moorhouselondon
moorhouselondon
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of joelsilva
joelsilva

ASKER

Hey man... You got it!
Very criative idea... Thx. very much!
Avatar of Wim ten Brink
HOLD IT!!!

copy /b /s >fred.txt

That doesn't work! Syntax is incorrect. Don't you mean:
dir /b /s >fred.txt
instead?

And:
dir /b /s /a-D >fred.txt
Might be even better since this would skip folders being listed.

But the simplest, one-line solution is this:

for /R s:\Source %f in (*.*) do copy "%f" c:\Target

An explanation is in it's place here. The for statement here uses this syntax:
  FOR /R [[drive:]path] %variable IN (set) DO command [command-parameters]
  Walks the directory tree rooted at [drive:]path, executing the FOR statement in each directory of the tree.  If no directory specification is specified after /R then the current directory is assumed.  If set is just a single period (.) character then it will just enumerate the directory tree.

It will overwrite existing files, though. But hey, you want it all in a single folder so that's the risk.
I know I'm too late with this but still thought this answer would be more useful.
 
You are absolutely right - joelsilva obviously knows dos well, or is a mind reader.