Autocopy Batch file from usb drive to hhd ?

HpBaxxter

New member
Local time
4:44 PM
Messages
55
Hello,
I need a batch file which auto copy files from any USB drive when it connected to a folder in the hard disk .
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Dell
OS
Windows 64bit
CPU
I7
Memory
4 GB
Graphics Card(s)
1GB
Sound Card
SRS
Hard Drives
500 GB
Browser
IE 11
The problem trying to do that is the USB drive may have different drive letters assigned at different times so the batch file would need to be able to find the USB drive in order to copy from it.

You may be able to do this with PowerShell or VB Script but I don't know how to do so.
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Lenovo IdeaCenter 450
OS
Windows 10 Pro X64
CPU
Intel Quad Core i7-4770 @ 3.4Ghz
Memory
16.0GB PC3-12800 DDR3 SDRAM 1600 MHz
Graphics Card(s)
Intel Integrated HD Graphics
Sound Card
Realtek HD Audio
Monitor(s) Displays
HP 22" LCD
Screen Resolution
1680 x 1050
Hard Drives
250GB Samsung EVO SATA-3 SSD
2TB Seagate ST2000DM001 SATA-2
1.5TB Seagate ST3150041AS SATA
Keyboard
Dell USB
Mouse
Lenovo USB
Internet Speed
Cable via Road Runner 3MB Upload, 30MB Download
Antivirus
Windows Defender, MBAM Pro, MBAE
Browser
Seamonkey
Other Info
UEFI/GPT
PLDS DVD-RW DH16AERSH
The problem trying to do that is the USB drive may have different drive letters assigned at different times so the batch file would need to be able to find the USB drive in order to copy from it.

You may be able to do this with PowerShell or VB Script but I don't know how to do so.
I didn't find the right forum to post my question, so I posted it here :D
Every time I have a problem I find the solution here .
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Dell
OS
Windows 64bit
CPU
I7
Memory
4 GB
Graphics Card(s)
1GB
Sound Card
SRS
Hard Drives
500 GB
Browser
IE 11
any one else can help me ?
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Dell
OS
Windows 64bit
CPU
I7
Memory
4 GB
Graphics Card(s)
1GB
Sound Card
SRS
Hard Drives
500 GB
Browser
IE 11
You should (IMO) clarify what you mean by auto-copy.

Auto-copy could mean:
...attach USB drive
...and the files of interest automatically copy to the folder of interest on the hard disk.

OR

Auto-copy could mean:
...attach USB drive
...and you manually start the batch file
...that copies the files of interest automatically copy to the folder of interest on the hard disk.

Which is it?

Maybe your batch file could search thru each drive letter - looking for a certain file name. Once that file name is found, then you know that the USB drive of interest is attached and then copy the files.

Code:
IF EXIST D:\ID-FILE.txt copy D:\*.* C:\folder\*.*
IF EXIST E:\ID-FILE.txt copy E:\*.* C:\folder\*.*
IF EXIST F:\ID-FILE.txt copy F:\*.* C:\folder\*.*
I'm sure that there is a pretty way to enumerate the possible drive letters.
 
Last edited:

My Computer My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Employer provided Dell Latitude
OS
W7 Pro SP1 64bit
CPU
i7
Memory
8GB
Graphics Card(s)
Intel HD Graphics
Hard Drives
crappy SSD
Antivirus
Employer mandated Symantec Endpoint Protection
Browser
Pale Moon 64bit, IE11 64bit & Chrome 64bit
If you control the content of the flash drive then you could put a batch file on it that does something like the following. We'll call it FlashAutocopy.bat.

xcopy \*.* %userprofile%\temp\autocopy\ /s/h/r/i/k/e/y /exclude FlashAutocopy.bat autorun.inf

(add /d if you only want to copy files that do not already exist in the autocopy folder)

xcopy \*.*says to copy all files and folders starting at the root of the flash drive.
%userprofile%\temp\autocopysays to copy to your profile directory, temp\autocopy folder.
/exclude FlashAutocopy.bat autorun.inf says to not copy these files.

You could also put a autorun.inf file in the root of the flash drive with one line it it that says:

open=
FlashAutocopy.bat

Then is autorun is enabled when you connect the flash drive it will automatically start FlashAutocopy.bat.
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Lenovo IdeaCenter 450
OS
Windows 10 Pro X64
CPU
Intel Quad Core i7-4770 @ 3.4Ghz
Memory
16.0GB PC3-12800 DDR3 SDRAM 1600 MHz
Graphics Card(s)
Intel Integrated HD Graphics
Sound Card
Realtek HD Audio
Monitor(s) Displays
HP 22" LCD
Screen Resolution
1680 x 1050
Hard Drives
250GB Samsung EVO SATA-3 SSD
2TB Seagate ST2000DM001 SATA-2
1.5TB Seagate ST3150041AS SATA
Keyboard
Dell USB
Mouse
Lenovo USB
Internet Speed
Cable via Road Runner 3MB Upload, 30MB Download
Antivirus
Windows Defender, MBAM Pro, MBAE
Browser
Seamonkey
Other Info
UEFI/GPT
PLDS DVD-RW DH16AERSH
If the usb drive is always put into the same usb port, you can assign a drive letter to it. I gave mine Z [for example]. To keep your cd-dvd device from entering the fray, assign it drive letter I [for example], and let your batchfile not specify drive letter I. Do you have your OS partition as C and data partition assigned drive letter D? That will keep a universal batchfile from accidentally copying from your data partition.
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Antec desktop; Acer Aspire laptops
OS
Windows 7 Professional 64-bit
CPU
Desktop i5; Acers i5 & i7
Memory
desktop 16GB; 1 Acer 8GB & 1 Acer 16GB
Hard Drives
1TB split into 2 equal partitions [OS and data] usable by RJS
Internet Speed
AT&T DSL
Browser
FF, GChrome, msIE
Other Info
Windows 7 Firewall, Emsisoft AM/AV, MSE [scan-only], SpywareBlaster, Ruiware/BillP combine
Back
Top