User User name Password  
   
Wednesday 8.1.2025 / 12:32
Search AfterDawn Forums:        In English   Suomeksi   På svenska
afterdawn.com > forums > software, operating systems and more > windows - general discussion > moving multiple folders with a batch file
Show topics
 
Forums
Forums
Moving multiple folders with a batch file
  Jump to:
 
Posted Message
Senior Member
_
4. February 2009 @ 00:55 _ Link to this message    Send private message to this user   
Can someone tell me what the line command is so I can move multiple folders and files in another folder. Basicly tell it to move all folders and files inside a specific folder. Say I have a folder on my desktop named 1. Now I want all folders and files in that folder moved without having to list all of the folders because these folder names will change on a daily basis
Advertisement
_
__
Mez
AfterDawn Addict
_
4. February 2009 @ 09:42 _ Link to this message    Send private message to this user   
If you do not specify a name how is the computer to know what to do? I do not believe you can move a folder and subfolders they way you would like to do it.

You could experiment using the xcopy command. That will copy a folder X with the subfolders. I have not written a batch file in many years I do not now if batch files/or the DOS window supports long file names. I also forget, you may be able to name the target or you can always rename the target folder maybe with a name passed to the batch file as a parameter. Then you would have to go into the folder X and delete *.*. That will accomplish the same thing. It is also safer if you trap write errors and exit out before the delete if an error occurs.
vballstud
Suspended permanently
_
4. February 2009 @ 10:34 _ Link to this message    Send private message to this user   

@echo off
copy "FULL PATH TO FOLDER OF FILES BEING COPIED" "FULL PATH OF DESTINATION FOLDER"

XP DOS prefers you to use full paths within quotation marks, unlike old DOS where each folder was only 8 characters and didn't like spaces.

This message has been edited since posting. Last time this message was edited on 4. February 2009 @ 10:36

Senior Member
_
4. February 2009 @ 10:57 _ Link to this message    Send private message to this user   
I can get it to copy folders and subfolders just fine. Just can't move the folders the way I want to. Oh well guess I'm screwed. Thanks for the responces
vballstud
Suspended permanently
_
4. February 2009 @ 11:39 _ Link to this message    Send private message to this user   
Originally posted by jerecho:
I can get it to copy folders and subfolders just fine. Just can't move the folders the way I want to. Oh well guess I'm screwed. Thanks for the responces

So basically you're cutting and pasting instead of just copying?
Replace "copy" with "move".

This message has been edited since posting. Last time this message was edited on 4. February 2009 @ 11:42

ucfmoe
Member
_
11. February 2009 @ 22:08 _ Link to this message    Send private message to this user   
I believe the command is

xcopy "source" "destination" /E /T

but i could be wrong, google xcopy commands, or you could use RoboCopy
Advertisement
_
__
 
_
PatMc9
Newbie
_
8. April 2009 @ 13:09 _ Link to this message    Send private message to this user   
Jerecho. If you want to move all files and sub-folders (at any level) from one folder to another folder, use the following commands in biterscripting. Here, the 'from' folder is C:/folder1, the 'to' folder is C:/folder2.


# Get a list of files and subfolders within C:/folder1.

var str list ; find -n "*" "C:/folder1" > $list
# Move each file and subfolder in the list to C:/folder2.
while ($list <> "")
do
var str item ; lex "1" $list > $item
system move $item "C:/folder2"
done

For automating things like this, especially when files/folders are created dynamically, and you don't know their names ahead of time, biterscripting turns out to be very helpful. Download it free at http://www.biterscripting.com/install.html . For example, if you want only to move files/folders created after Feb 3, 2009, add the following to the find command.


($fctime > "20090203")


PatrickMc
afterdawn.com > forums > software, operating systems and more > windows - general discussion > moving multiple folders with a batch file
 

Digital video: AfterDawn.com | AfterDawn Forums
Music: MP3Lizard.com
Gaming: Blasteroids.com | Blasteroids Forums | Compare game prices
Software: Software downloads
Blogs: User profile pages
RSS feeds: AfterDawn.com News | Software updates | AfterDawn Forums
International: AfterDawn in Finnish | AfterDawn in Swedish | AfterDawn in Norwegian | download.fi
Navigate: Search | Site map
About us: About AfterDawn Ltd | Advertise on our sites | Rules, Restrictions, Legal disclaimer & Privacy policy
Contact us: Send feedback | Contact our media sales team
 
  © 1999-2025 by AfterDawn Ltd.

  IDG TechNetwork