Solved

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

Posted on 2004-09-27
4
199 Views
Last Modified: 2010-04-05
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.
0
Comment
Question by:joelsilva
  • 2
4 Comments
 
LVL 31

Accepted Solution

by:
moorhouselondon earned 25 total points
ID: 12164178
Wait for it... Cracking an egg with a sledgehammer.

use copy /b /s >fred.txt

this will put all the filenames with paths into a file called fred.txt.

Now go into Excel and bring in the file fred.txt.  Insert a column before the list and put:

COPY

into cell A1.  Replicate this down to the bottom of the list.  Export the list as a Space delimited text file with a BAT extension.  Create an empty directory, go into DOS CD to that directorty and run the BAT file from there.

Whatever happened to EDLIN?  With EDLIN you could do this sort of thing.

0
 

Author Comment

by:joelsilva
ID: 12165968
Hey man... You got it!
Very criative idea... Thx. very much!
0
 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 12168924
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.
 
0
 
LVL 31

Expert Comment

by:moorhouselondon
ID: 12171877
You are absolutely right - joelsilva obviously knows dos well, or is a mind reader.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now