Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Struggling with CMD - Copy

09 Oct 2017   #1
fakeacc

Windows 7 x64 and windows 10 x32
 
 
Struggling with CMD - Copy

Hello SF world,

I recently thought I found a fix for my issue on this forum, sadly it did not work
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 System SpecsSystem Spec
.
09 Oct 2017   #2
mrjimphelps

Linux Mint 18.2 xfce 64-bit (VMWare host) / Windows 8.1 Pro 32-bit (VMWare guest)
 
 

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 System SpecsSystem Spec
09 Oct 2017   #3
fakeacc

Windows 7 x64 and windows 10 x32
 
 

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 System SpecsSystem Spec
.

09 Oct 2017   #4
samuria

win 8 32 bit
 
 

There are lots of free search programs that will do this then let you copy the results better still is a free file manager with super fast search and you can then copy files within manager Alternative to Windows Search For Files + Duplicates Search
My System SpecsSystem Spec
09 Oct 2017   #5
fakeacc

Windows 7 x64 and windows 10 x32
 
 

Quote   Quote: Originally Posted by samuria View Post
There are lots of free search programs that will do this then let you copy the results better still is a free file manager with super fast search and you can then copy files within manager Alternative to Windows Search For Files + Duplicates Search
wish I could sadly this is a corporate device 3rd party applications are a no go, my Dir search has been running for about an hour now guess I'll have to keep on waiting
My System SpecsSystem Spec
09 Oct 2017   #6
fakeacc

Windows 7 x64 and windows 10 x32
 
 

Quote   Quote: Originally Posted by mrjimphelps View Post
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 System SpecsSystem Spec
09 Oct 2017   #7
samuria

win 8 32 bit
 
 

The file manager is portable so is the other so no need to install can run from usb
My System SpecsSystem Spec
Reply

 Struggling with CMD - Copy




Thread Tools




Similar help and support threads
Thread Forum
struggling with the old stuff still on this laptop
Hello :), Very stupid question perhaps, if you clean the disk, will that take everything away the former users put on the PC ? Thanks for any answers in advance, Cheers, Thelma
General Discussion
Permissions, I am really struggling
Background I have been using VS Revo Pro to uninstall a number of unwanted programs, and in the process noticed that saving of neither a registry backup nor a system restore point was happening. I contacted VS Revo, and it was suggested that the problem could lay with the permissions settings....
General Discussion
Mouse struggling to highlight test for copy/paste action
NOTE: The issue is in win 7. I've swapped the mouse with the other PCs. The mouse works fine on other PCs. And all mouses struggle on this PC. hard to highlight text for copy/pasting. The blue highlite bar wont behave. Can't seem to grab all the text. And it keeps moving & releasing with...
General Discussion
BSOD - Struggling to understand
Hi all, im new here as you can see and i'm sorry if this seems like a simliar post, but believe me ive been struggling for last few hours over internet on information and how to do things and getting in all kinds of trouble (i will admitt im not 100% best at computers), so here goes whats been...
BSOD Help and Support
Internet connection struggling
Hi All, I recently purchased a new system (custom built) with the following specs: Intel core i7 950 CPU (not overclocked) 6 GB Ram ASUS P6X58D-E Motherboard ATI Radeon HD 6870 (2 in crossfire) Windows 7 Ultimate x64
Network & Sharing


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 04:02.
Twitter Facebook Google+