Struggling with CMD - Copy

fakeacc

New member
Local time
2:18 PM
Messages
4
Hello SF world,

I recently thought I found a fix for my issue on this forum, sadly it did not work :cry:
So none the less I'd like to try asking my specific issue.

Summary
I need to copy over 1000 files that are all in PDF from a shared drive that has a few hundred TB of data.
I've been given a list of unique identifiers(all #s) for the ones I need however the files I need contain both a numerical value and 1 or 2 alphabetic ones additionally some may have the hyphen between numbers and letters.

Information
I know the exact root folder path thing is my desired PDFs may be located in 2-3 sub-folders if not more...
(Let's call the shared Drive T: )
Just to get an idea of what mapping i'm dealing with T: will break into many folders which i'm not concerned about that since I know exactly which 1st sub-folder they should be in
Once i'm in my folder I hit a dead end as my desired files may could be in Folder 1,2,3,30,40,50.
I have no way of knowing exactly where they are other than searching one by one... but we all know how time consuming that is.

I've tried a few variations to attempt to locate them;

First from an excel sheet I converted to *.bat

Command Output: Current Folder Path File Name Enter Destination Folder Path Below
COPY "T:\Main\Test1test.pdf" XXXXXX "T:\Main\Test2"

Then I tried my luck with CMD after spending quite sometime on google;
echo off

set LISTFOLDER=T:\Main\Test1
set FILESPATH=T:\Main\Test1\Filelist
set DESTPATH=T:\Main\Test2

for /f "tokens=*" %%i in ('dir /b ^"%LISTFOLDER%\*.txt^"') do (call :COPY_FILES "%LISTFOLDER%\%%i")

pause
exit

:COPY_FILES
for %%i in (%1) do set DEST=%%~ni
for /f "usebackq delims==" %%i in (%1) do xcopy /qv "%FILESPATH%\%%i" "%DESTPATH%\%DEST%\*"

No luck either. I'm not any good with CMD as I've never learned it (though now I wish I had...)

Desired resolution
I'd like to have someone show me where am going wrong by giving me the proper cmd, I understand that a wildcard value might help but would this be any good for both hyphens and alphabetical values after the numbers most files should not have any spaces but then again I'd rather cover all angles.

Thanks in advance to whoever replies,
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Asus and Lenovo
OS
Windows 7 x64 and windows 10 x32
The easiest way to get a listing of all of the PDF files which are on your shared drive is to use the DIR command to generate a text file listing of all of the files. We will do everything from a command prompt, so open a command prompt.

If you don't have a TEMP folder on your C: drive, create one.
Type MD C:\TEMP [ENTER]

Now generate a listing of all of the PDF files on your shared drive.
DIR T:\*.PDF /s > C:\TEMP\pdflist.txt

* The '/s' tells the DIR command to look in all subdirectories on drive T:.
* The '>' directs the output of the command to the text file that appears after it.

Now you have a text file which contains a listing of every PDF file on your T: drive.

At this point, you'll need to look at the file listing to see where all of the PDF files are, so you'll know best how to proceed with the actual copy process. I wouldn't get too fancy or complicated with a batch file; you'd probably be better off just doing the copy manually using File Explorer in Windows.
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Dell
OS
Linux Mint 18.2 xfce 64-bit (VMWare host) / Windows 8.1 Pro 32-bit (VMWare guest)
CPU
Haswell
Memory
4 GB
Monitor(s) Displays
Acer 23"
Screen Resolution
1920 x 1080
Hard Drives
Two hard drives, 1TB each: One for Linux, one for my data.
Keyboard
IBM Model M
Antivirus
Sophos (Linux), Trend Micro (Windows)
Browser
Firefox, Opera
Other Info
I use Samba to share my data drive with the other computers at my house and with my guest session in VMWare Workstation Player.
Thanks for the DIR suggestion, I never thought of that.

I still feel there should be a better way then to manually copy over 1000 files.

I understand the whole KISS principle, but is there a cmd function that could copy from the list I'll filter out once the -DIR is finished compiling the information ?
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Asus and Lenovo
OS
Windows 7 x64 and windows 10 x32

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Asus and Lenovo
OS
Windows 7 x64 and windows 10 x32
The easiest way to get a listing of all of the PDF files which are on your shared drive is to use the DIR command to generate a text file listing of all of the files. We will do everything from a command prompt, so open a command prompt.

If you don't have a TEMP folder on your C: drive, create one.
Type MD C:\TEMP [ENTER]

Now generate a listing of all of the PDF files on your shared drive.
DIR T:\*.PDF /s > C:\TEMP\pdflist.txt

* The '/s' tells the DIR command to look in all subdirectories on drive T:.
* The '>' directs the output of the command to the text file that appears after it.

Now you have a text file which contains a listing of every PDF file on your T: drive.

At this point, you'll need to look at the file listing to see where all of the PDF files are, so you'll know best how to proceed with the actual copy process. I wouldn't get too fancy or complicated with a batch file; you'd probably be better off just doing the copy manually using File Explorer in Windows.


Is it suppose to take quite a while to complete ?
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Asus and Lenovo
OS
Windows 7 x64 and windows 10 x32
The file manager is portable so is the other so no need to install can run from usb
 

My Computer

Computer type
PC/Desktop
OS
win 8 32 bit
Back
Top