| 1. |
Solve : Help with unknown path? |
|
Answer» Hello everyone! Now I need to copy a set of files to different sub folders within that job folder. What sub folders? Do they exist already? How is the script to know which files go into which sub folders? Please note that while an asterisk wildcard will find a folder that matches the string* spec, it won't magically read your mind and create folders based on what you want. Quote "C:\Program Files\Winrar\WinRAR.exe" x %pathStart% *.* %pathEnd% What do you think the bit in bold red will do? From the WinRar help file: Quote unpack the archive Info.rar to folder d:\data Here is the full code. (see bottom) I've updated it a bit since I posted this question but I'm still pretty MUCH stuck at the same spot. I've learned a little bit from you already though. Even in another post you were involved in which gave me an idea for this! So thank you! The sub folders are the same in every job folder and I tell the program the path at the beginning. I planned on just using these as a suffix to the job folder path after the program finds it. I know the asterisk won't create folders for me. The job folder's name looks something like this. "1121 Construction Company 165 Apple Rd, New York" So only the number assigned to the job at the beginning of the folder is a known value for all the workers who would use this. I have no idea what the bit in red does lol. That PORTION of code I have copied and pasted and used in a few small bat programs. Some things that I've changed since the last post are as follows. I saw a post of yours about copying a folder found with the asterisks so you can get it's name. Not sure if I worded that correctly but basically I think I need to find the job folder with Code: [Select]if exist "%drive%:\%jobNumber%*" ( set temp=%drive%:\%jobNumber%* xcopy /t /e "%temp%" "C:\TEMP" ) I keep getting cyclic copy error with that though so I've tried this a few ways like setting the variable temp. I'm only copying the folder and no files so I can later tell the program to look for a folder in the "NY SERVER" with the same name as the copied folder. Maybe I am completely headed in the wrong direction now. Sorry if this is lengthy but to sum it all up this is what I need the program to do. Find a folder on the "NY SERVER" based on it's first numbers. Then copy files to predetermined sub folders within that job folder. vvv FULL CODE SO FAR vvv Code: [Select]@echo off title Release A Job color a set drive=C set pathStart="%~dp0\job.zip" set pathEnd=0 set pathEnd1="06. SHOP DRAWINGS" set pathEnd2="13. PRODUCTION ( In House)" set pathEnd3="15. INSTALLATION PACKAGE" :main cls echo. echo Enter the number of your choice and press "Enter" echo. echo (1) Enter echo (2) Change your NY Server Location (Current drive: "%drive%:\") echo (3) Exit set /p gateMain= if %gateMain% == 1 goto step1 if %gateMain% == 2 goto drive if %gateMain% == 3 exit goto main :step1 cls echo. echo Enter the job number only echo. set /p jobNumber= set jobFolderCheck=a set jobFolder=a if exist "%drive%:\%jobNumber%*" ( goto success ) goto fail :fail color c cls echo. echo THIS JOB DOES NOT EXIST echo. echo Make sure your computer has the NY Server Labeled in the %drive%:\ Drive echo If not you have to change this on the main menu (Option "2") echo. pause color a goto main :success cls echo. echo This job was found. echo No errors to this point echo. pause cls set temp=%drive%:\%jobNumber%* xcopy /t /e "%temp%" "C:\TEMP" set pathEnd="%drive%:\%jobNumber%*" "C:\Program Files\Winrar\WinRAR.exe" x %pathStart% %pathEnd% pause exit :drive cls echo What is the "NY Server's" letter on your computer. echo For example your main computer is likely labeled C echo. echo (Current drive: "%drive%:\") echo If this does not match your computer's label echo please enter the correct letter and press "Enter" echo. echo Enter "1" to go back to the main menu echo. set /p gateDrive= if exist "%gateDrive%:\" ( set drive=%gateDrive% goto main ) if %gateDrive% == 1 goto main goto drive If I don't get a cyclic copy error it copies the whole NY server not just the job folder. Any ideas why? By the way I keep calling it a server but it's really just a drive that is accessible through the company's network. Code: [Select]xcopy "%drive%:\%jobNumber%*" C:\TEMP /t /e |
|