Go Back   TechArena Community > Software > Windows Software
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read SiteMap

Tags: , , , , , ,

Batch File to Move or Copy Files

Windows Software


Reply
 
Thread Tools Search this Thread
  #1  
Old 05-01-2010
Pratim's Avatar
Member
 
Join Date: Aug 2006
Posts: 93
Batch File to Move or Copy Files

I want to create the Batch File to move executable files from a source directory and its sub-folders to another location. Also I want to create the Batch File to copy certain files in the specific location. Does anyone have an idea how to create it? Please help me as soon as possible.
__________________
"All gave some, some gave all."
Reply With Quote
  #2  
Old 05-01-2010
Glenny's Avatar
Member
 
Join Date: May 2008
Posts: 2,854
Re: Batch File to Move or Copy Files

You can try the following batch code to Move the files :
@echo off
for /F "delims=" %%i in (files.txt) do (
echo %%i
move "%%i" c:\hello
)
Space is a default delimiter. The delims parameter fixes that (here there are no default delimiters other than a newline). You'll also need double quotes around your variable name on the move line. Hope that you were looking for the same.
Reply With Quote
  #3  
Old 05-01-2010
Macarenas's Avatar
Member
 
Join Date: May 2008
Posts: 3,091
Re: Batch File to Move or Copy Files

Try the batch command that I mentioned below which can be useful to copy the files :

set path=c:\WINDOWS\system32;
echo Copying started at %date% %time%>>_date_.txt
xcopy E:\backup \\SERVER\BACKUP\others /s /a /d
echo Copying finished at %date% %time%>>_date_.txt
echo Completed Successfully at %date% %time%>>_date_.txt
Reply With Quote
  #4  
Old 05-01-2010
ThoMas321's Avatar
Member
 
Join Date: Apr 2008
Posts: 2,766
Re: Batch File to Move or Copy Files

I think that the Batch Code mentioned by the "Macarenas" should work. I have not tried to check that personally, but seeing that I guess it should work properly. If you are not able to then just use
Xcopy directory [destination-directory]
and then turn this into a .BAT file
You can find the more information regarding your query at Batch file to copy a file from the local drive to a computer on lan?
__________________
Ram requirement for various OS
Reply With Quote
  #5  
Old 05-01-2010
Sam.D's Avatar
Member
 
Join Date: Jan 2008
Posts: 2,480
Re: Batch File to Move or Copy Files

I have used the following script to copy file quickly from source to destination. This script can work on Windows XP, 2003 or the lower version. This script accept the two command line argument and the syntax for that is :
mycopy.bat {source} {destination}
Where,
mycopy.bat is script that copies files and directories including subdirectories using Windows xcopy program.
source is used to specify the location and names of the file/directory you want to copy.
destination is used to specify the destination of the files you want to copy.
Reply With Quote
  #6  
Old 05-01-2010
Raine's Avatar
Member
 
Join Date: May 2008
Posts: 2,082
Re: Batch File to Move or Copy Files

The source code of the mycopy.bat should be as follows :
@rem BATCH FILE
@echo off
if "%1" == "" goto error1
if "%2" == "" goto error2
@rem * Copy from source to destination including subdirs and hidden
@rem * File
xcopy "%1" "%2" /S /E /H
goto endofprogram
:error1
echo You must provide source
echo Syntax:
echo %0 source destination
goto endofprogram
:error2
echo You must provide destination
echo Syntax:
echo %0 source destination
goto endofprogram
:endofprogram
Reply With Quote
  #7  
Old 21 Hours Ago
Member
 
Join Date: Dec 2009
Posts: 12
Re: Batch File to Move or Copy Files

Quote:
I want to create the Batch File to move executable files from a source directory and its sub-folders to another location.

Code:
# Script MoveExe.txt
var str source, destination, list, file
lf -r -n -g "*.exe" $source > $list
while ($list <> "")
do
    lex "1" $list > $file
    system move ("\""+$file+"\"") ("\""+$destination+"\"")
done


Script is in biterscripting. Save the script in file "C:/Scripts/MoveExe.txt". To call the script, type this command into biterscripting GUI.

Code:
script "MoveExe.txt" source("C:/testfolder1") destination("C:/testfolder2")

Will move all .exe files from the source directory "C:/testfolder1" and its sub-folders (see the -r flag) to the destination folder of 'C:/testfolder2".
Reply With Quote
Reply

  TechArena Community > Software > Windows Software


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads for: "Batch File to Move or Copy Files"
Thread Thread Starter Forum Replies Last Post
Create Batch file for laptops to copy templates Hemal Active Directory 1 2 Weeks Ago 04:10 PM
Cannot delete/copy/move .MOV files JoeT Vista Help 8 16-01-2010 10:35 PM
Can't Copy/Move Ext HD Files to iMac Joe Michaels Hardware Peripherals 1 25-08-2009 11:11 AM
Batch file to copy a file from the local drive to a computer on lan? dudelearn Tips & Tweaks 3 12-03-2009 12:56 PM
Do you want to move or copy files from this zone? geircito Windows Vista Network 1 06-11-2006 10:21 PM


All times are GMT +5.5. The time now is 06:52 PM.