Solved

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

Posted on 2004-09-27
4
200 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

863 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

21 Experts available now in Live!

Get 1:1 Help Now