Solved

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

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi cmd execution 6 62
Communication Between RC4 Delphi <-> PHP 3 115
Delphi - replicating a form 8 77
RESTRequest Parameter 4 32
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

825 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