Maya Training

Introduction to Hard Surface Modeling

Maya Training

Interiors and Furniture Vol 1 & 2 - Modeling & Cloth

Maya Training

Shading, Lighting and Rendering the Bedroom in MR

Maya Training

Robot volume one - Modeling with animation in mind

Maya Training

Spach-Alspaugh House the complete courseware

Maya Training

Burt The Cartoon Dinosaur Vol 01 - Modeling

New Maya Training

Robot Volume 02 - Hybrid Rigging
You are here > Home > SimplyMaya Community Forums
Loading

Welcome to Simply Maya

Please Sign in or Sign up for an account

Member Login

Lost your password?

Not a member yet? Sign Up!

Old 07-11-2003, 02:10 AM   #1
Darkware
Subscriber
 
Darkware's Avatar
 
Join Date: Oct 2002
Location: USA
Posts: 1,172
Thanks: 0
Thanked 4 Times in 4 Posts
Default help with batch files. (.bat)

I'm trying to learn how to make batch files on my own so I can easily do certain things on my computer like erase my temporary internet files with a single click of the mouse, but am running into trouble.

First of all, for those of you who don't know the first thing about batch files:
-you save them as .bat An example is filenumberone.bat
-They have about 8 basic commands that are fairly easy to learn.
-by executing a batch file, you can do several things at once.

Now, right now, I'm just in the testing phase, so I created a directory.

C:\Documents and Settings\Administrator\Desktop\Master\TESTMAIN\TES TSUB

The command I'm using in the batch file (erase.bat) is

del C:\Docume~1\Admini~1\Desktop\Master\TESTMAIN\TESTS UB

The reason I changed the first two directories with a ~1 at the end is because batch files are run through DOS. DOS does not like file names with more than 8 characters. It automatically recognizes the files in their abreviated form.

Now, this works, but it only deletes files IN the directory. What I'm wanting to know is if there is a way to delete the actual FOLDERS - not just the files inside the folders.

Any ideas?
__________________
www.Darkware3D.com
Darkware is offline   Reply With Quote
Old 07-11-2003, 02:46 AM   #2
Darkware
Subscriber
 
Darkware's Avatar
 
Join Date: Oct 2002
Location: USA
Posts: 1,172
Thanks: 0
Thanked 4 Times in 4 Posts
Default

nevermind. I figured it out. I needed the deltree command, but that particular command is not in windows 2000, so I have to stick /s /q at the end of RD C:\docume~1 blahblahblah

Stick around though. I might have some other problems that need fixing. lol
__________________
www.Darkware3D.com
Darkware is offline   Reply With Quote
Old 07-11-2003, 08:53 AM   #3
dave_baer
Moderator
 
dave_baer's Avatar
 
Join Date: Sep 2002
Location: Plantation, Florida
Posts: 1,568
Thanks: 0
Thanked 12 Times in 9 Posts
Default

Interesting... Could you post the batch files?
__________________
Dave Baer
Professor of Digital Arts
Digital Media Arts College
Boca Raton, Florida
dbaer@dmac.edu
dave_baer is offline   Reply With Quote
Old 07-11-2003, 10:19 PM   #4
Darkware
Subscriber
 
Darkware's Avatar
 
Join Date: Oct 2002
Location: USA
Posts: 1,172
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Here's how you make your own batch file. It's really simple.

-Open Notepad.
-type:

@ECHO OFF
RD C:\Docume~1\Admini~1\Desktop\Master\TESTMAIN\TESTS UB /s /q
CLS

-File>Save As..... name of file here.bat

The echo command is really unessesary since it happens in the blink of an eye anyway. The RD stands for "remove directory." Then you have the file path which is C:\Docume~1\Admini~1\Desktop\Master\TESTMAIN\TESTS UB The /s removes all directories and files in the specified directory in addition to the directory itself. It is used to remove a directory tree in other words. /q is "quit mode" which is like "no questions asked." It does whatever command you typed before it without asking you "Do you really want to delete this file?"

That's about it though. If you really want to piss someone off, you could do exactly what I described above, only have it delete another more important file on a computer. I don't know if it would do it or not while a user is actually running Windows, but you could have it delete the actual windows file for instance. What's more is that you can stick this on a CD with an autorun file. You can have the autorun file automatically execute the batch (.bat) file and "poof!" the files are deleted just as soon an the computer spins the CD up. You can add asteriks to your file paths to add some varience to your collection of files to delete if you like as well.

But ummm *cough* you shouldn't be doing stuff like this anyway, so I'll shut up. Seriously, although doing this with autorun and batch files is a common thing (especially in my tech class at school) you really shouldn't go around doing this to people. Usually, if I were going to do this, it would only be to erase the same files on several computers at school or a workplace that are corrupted from a virus or are no longer needed. This is a very useful thing to know if you're doing stuff like that.
__________________
www.Darkware3D.com

Last edited by Darkware : 07-11-2003 at 10:24 PM.
Darkware is offline   Reply With Quote
Old 08-11-2003, 06:33 AM   #5
Darkware
Subscriber
 
Darkware's Avatar
 
Join Date: Oct 2002
Location: USA
Posts: 1,172
Thanks: 0
Thanked 4 Times in 4 Posts
Default

ok, I'm trying to do something else now, but I doubt it can be done with a batch file.

I want to be able to type out a document, then run a batch file that will change the character "a" to "f", "b" to "x", etcetc for every character to encrypt it. I know you can go into MS Word and do control+h to bring up the "replace" window, but I don't want to have to type everything out each time I want to do this.

So, my question is..... is there some kind of "replace a with b" syntax with a replace command to do what I described above that will go into a batch file?

Thanks in advance.
__________________
www.Darkware3D.com
Darkware is offline   Reply With Quote
Old 08-11-2003, 08:33 AM   #6
Zyk0tiK
Registered User
 
Zyk0tiK's Avatar
 
Join Date: Aug 2003
Posts: 800
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hey you dont want to use a deltree or eqquivilent. else it'll delete the whole folder, if you're deleting the temp intarrwebb files then the folder isn't a good thing to delete :|
Zyk0tiK is offline   Reply With Quote
Old 08-11-2003, 03:49 PM   #7
Darkware
Subscriber
 
Darkware's Avatar
 
Join Date: Oct 2002
Location: USA
Posts: 1,172
Thanks: 0
Thanked 4 Times in 4 Posts
Default

yeah I know. deltree isn't fn Windows2000 so you have to use RD. RD only romoves the folder contents and the folder itself if you have /s at the end.
__________________
www.Darkware3D.com
Darkware is offline   Reply With Quote
Old 09-11-2003, 01:58 AM   #8
Zyk0tiK
Registered User
 
Zyk0tiK's Avatar
 
Join Date: Aug 2003
Posts: 800
Thanks: 0
Thanked 0 Times in 0 Posts
Default

you dont ever wanna remove the folder itself...
Zyk0tiK is offline   Reply With Quote
Old 09-11-2003, 02:02 AM   #9
Darkware
Subscriber
 
Darkware's Avatar
 
Join Date: Oct 2002
Location: USA
Posts: 1,172
Thanks: 0
Thanked 4 Times in 4 Posts
Default

unless you're doing what I described earlier with deleting entire files with the directories they're in like Windows. Of course, that's only if you want to really piss someone off.....

But, there are times you will want to delete the actual folder with all its content included.
__________________
www.Darkware3D.com
Darkware is offline   Reply With Quote
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
Batch Rending Render Layers Ozgalis Lighting & Rendering 7 07-01-2011 07:04 PM

Thread Tools





A little bit about who we are
Links you might find useful
Catch up with SimplyMaya
SimplyMaya specialises in Maya tutorials. We offer over 1,000 individual Maya training videos, ranging from basic Maya tutorials through to intermediate Maya tutorials. Our tutorials are created by instructors with industry experience and are designed to get you up and running in Maya quickly without making it seem like hard work.

Copyright © 1999-2015 SimplyMaya - vBulletin® Copyright © 2000-2015, Jelsoft Enterprises Ltd.