Help writing a rm script
I was wondering how I would write a script which would remove all my temporary internet files in in my temporary internet files folder
C:\Documents and Settings\Owner\Local Settings\Temporary Internet Files is where they are loacted I tried writing it but cant seem to stop getting error messages] I am a complete :newbie: to Linux, I tried: Code:
for files in C;\Temporary Internet Files\Owner\Local Settings\Temporary Internet Files; do; rm *.*; done any suggestions Also I am currently using Cygwin for windows and using the emacs editor any other suggestions or what am I doing wrong??? |
Can't you just do
Code:
rm -rf /cygdrive/c/Documents\ and\ Settings/zechs/Local\ Settings/Temporary\ Internet\ Files/* |
I'm not using cygwin so this may not be of any use -
You probably have to escape the spaces in the directory names lik c:\Documents\ and\ Settings\Owner\Local Settings\Temporary\ Internet\ Files why not just do cd c:\Documents\ and\ Settings\Owner\Local Settings\Temporary\ Internet\ Files\ echo $PWD to see if it's getting to the right directory, then change it to rm -rf c:\Documents\ and\ Settings\Owner\Local Settings\Temporary\ Internet\ Files\* if it is Edit: great minds think alike :) |
yeah its part of my class at school to write scripts, I thought this would be a rather easy one but info like that Demonbane such as where cyg mounts the C drive is new to me. Plus I,m a complete Newb just started learning linux
|
Well Neither one worked, it couldnt change the directory to that, and Demon, it just ran the dropped to me the next prompt and didnt delete the files.:(
|
Make sure you create a /cygdrive directory, its isnt created by default for some reason, though the mount points are.
and its not suppose to give any output unless you add a "-v" switch. If you want to use a for loop you need a wildcard Code:
for files in /cygdrive/c/Documents\ and\ Settings/zechs/Local\ Settings/Temporary\ Internet\ Files/*; do rm $file; done |
where do I add a -v switch we have never learned those,
also this may seem like a stupid question but do I need to make the folder like others ie : right clicking make new folder and nameing it cygdrive?? |
Quote:
rm -rvf <blah blah> Quote:
get in Cygwin bash prompt Code:
mkdir /cygdrive |
For some readon it isnt working, let me put my code in here so you can take a look.
Code:
for files in /cygdrive/c/Documents\ and\ Settings/zechs/Local\ Settings/Temporary\ Internet\ Files/* I dont see whats missing I tried it with and with out a \ after internet since I am guessing the / is separating the directories and the \ is the for the literal character of a space between the words :) BTW the cmd mkdir made a cygdrive folder under my main cygwin drive /C:/cygwin/cygdrive thats what it was supposed to do correct? should I put the script in the cygdrive folder? then cd cygdrive and run it? |
btw "zechs" is my username on my windows box, change it to yours
where the script is doesnt matter since you're using absolute path |
Therefore I change zechs to Owner which appears in the upper left corner of my windows box.
After doing so same promblem, no output =P do I need a : after c was I correct in placing a \ after internet? or should I have left it internet files instead of Interent\ Files |
yes you need the backspace, if you're doing it inside Cygwin bash
cd into /cygdrive/c/Documents\ and\ Settings/Owner/Local\ Settings/Temporary\ Internet\ Files/ do "rm -rvi *' and see what happens |
Nevermind, disregard that owner comment, what do you mean windows box, windows is just a bunch of damn boxes, where can I find my name, such as you described.
I truly appreciate the patientence and help. |
OK I see what that did duh, it then prompts me to delete the file and there is a ton!!!
Is there a way I can make it auto delete all of these, and yes it was Owner (hits himself cause its 5 in the morning) would this script work Code:
echo "would you like to delelte your temp internet files" |
yea just change
rm -rvi * to rm -rvf * |
All times are GMT -5. The time now is 12:19 PM. |