TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: ronjonp on November 10, 2003, 04:34:54 PM

Title: .bat question
Post by: ronjonp on November 10, 2003, 04:34:54 PM
Not a lisp question, but.......In a .bat file, how do I make a wildcard folder when copying files from one location to another?

Example

copy "S:\AutoCAD 2002\STAMP.dwg" "C:\Documents and Settings\???\Application Data\Autodesk\AutoCAD 2004\R16.0\enu\Support*"

Thanks,


Ron
Title: .bat question
Post by: Craig on November 10, 2003, 04:42:23 PM
You can use xcopy instead of copy and have it select "D" for you. Is that what you were wanting. It's been so long since I'ver heard batch file, I have forgotten alot of it
Title: .bat question
Post by: Craig on November 10, 2003, 04:45:41 PM
What you might end up having if the above is what your after is
echo d|xcopy c:\AutoCAD 2002\stamp.dwg c:\My New Folder
where My New Folder is where you would want it copied to
Title: .bat question
Post by: ronjonp on November 10, 2003, 04:51:58 PM
The folder name already exists (logon name). I need it to accept whatever the name of that folder is and proceed to copy. Right now it prompts "path not found".  :?:
Title: .bat question
Post by: Mark on November 10, 2003, 04:52:44 PM
Code: [Select]
REM cpt.bat
REM Batch file to copy STAMP.dwg to a users ACAD Support folder
REM Usage cpt <user name>
REM Example cpt John
%1
copy "S:\AutoCAD 2002\STAMP.dwg" "C:\Documents and Settings\%1\Application Data\Autodesk\AutoCAD 2004\R16.0\enu\Support"
Title: .bat question
Post by: Craig on November 10, 2003, 04:57:16 PM
Go Mr. Thomas, you da man

How the hell do you remember that stuff? I haven't done any major batch filing in ages.
Title: .bat question
Post by: Mark on November 10, 2003, 05:30:12 PM
Quote from: Craig
Go Mr. Thomas, you da man

How the hell do you remember that stuff? I haven't done any major batch filing in ages.

I still use them!  :shock:
Title: .bat question
Post by: ronjonp on November 11, 2003, 01:47:23 PM
This is what I ended up with.

copy "S:\AutoCAD 2002\STAMP.dwg" "C:\Documents and Settings\%username%\Application Data\Autodesk\AutoCAD 2004\R16.0\enu\Support"

 :D
Title: .bat question
Post by: Mark on November 11, 2003, 02:13:52 PM
Quote
%username%

Now why didn't I think of that ................ Excellent
Title: .bat question
Post by: ronjonp on November 11, 2003, 06:17:47 PM
Better yet..

xcopy "S:\AutoCAD 2002\STAMP.dwg" "%appdata%\Autodesk\AutoCAD 2004\R16.0\enu\Support"/Q/R/S/I/Y/K

 :wink:
Title: .bat question
Post by: ronjonp on November 20, 2003, 12:30:21 PM
Hey Mark (or any .bat inclined  :D ),

Probably a stupid question but.....How do I delete empty folders in a dir?
Also how do I just delete a folder? I can delete the files within the folder but cannot delete the folder itself??

Thanks,

Ron
Title: .bat question
Post by: daron on November 20, 2003, 12:36:57 PM
Are you trying to do it manually? Make sure it isn't read-only.
Title: .bat question
Post by: ronjonp on November 20, 2003, 12:44:21 PM
I took the read only attribute out of all the files but still cannot get the dir to delete?  ---> attrib -R "C:\Program Files\Microsoft Office\Templates

This is what I have:

del "C:\Program Files\Microsoft Office\Templates\Binders"
Title: .bat question
Post by: Craig on November 20, 2003, 01:10:00 PM
You can use rd to Remove Directories aka folders
Title: .bat question
Post by: ronjonp on November 20, 2003, 01:15:08 PM
Thanks Craig  :oops:
Title: .bat question
Post by: Craig on November 20, 2003, 01:17:32 PM
No problem, glad I could finally be of SOME help. Been really busy here at work. I guess thats good....Job Security :?:
Title: .bat question
Post by: Mark on November 20, 2003, 01:27:22 PM
It's because an app (most likely explorer) has an open handle to the dir. You can close them with a program called Process Explorer from sysinternals.

http://theswamp.org/#freeware