Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2004-09-27
4
Medium Priority
?
205 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 31

Accepted Solution

by:
moorhouselondon earned 100 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

715 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