Reply
Script Request...
Old 11-09-2008, 01:14 PM Script Request...
Brian07002's Avatar
Super Spam Talker

Posts: 869
Name: ...
Location: ...
I would like to delete some images from a folder, but these images contain brackets in them [ ] how can I delete just the one's with [ ] in the filename? Could be either windows -- batch or Linux bash...Either would do.

Thanks
Brian07002 is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 11-09-2008, 04:11 PM Re: Script Request...
Brian07002's Avatar
Super Spam Talker

Posts: 869
Name: ...
Location: ...
Never Mind, I figured it out another way...But I'll take other replies
Brian07002 is offline
Reply With Quote
View Public Profile
 
Old 11-14-2008, 06:48 AM Re: Script Request...
Novice Talker

Posts: 6
how did you solve the problem?
penalty is offline
Reply With Quote
View Public Profile
 
Old 11-14-2008, 01:10 PM Re: Script Request...
Extreme Talker

Posts: 201
Windows batch
Code:
del *[*]*
Linux bash
Code:
rm *\[*\]*
__________________
Bulbous Bouffant | NinjaSurf
CouponGuy is offline
Reply With Quote
View Public Profile
 
Old 11-19-2008, 01:55 PM Re: Script Request...
witnesstheday's Avatar
Alright my lads.

Posts: 390
Name: Shams Pirani
Location: London
Well since you're taking other replies, howabout: why don't you read the man pages or the help info for the linux command RM?? i mean it's pretty easy to remove anything you want, throwing in asterisks when you need em and generally being competent in using linux. why has someone let you run a linux server if you can't use the RM command? is there any logic in this? i'm sorry if i sound callous, i haven't had my whisky and soda yet, but i will. i will.
witnesstheday is offline
Reply With Quote
View Public Profile Visit witnesstheday's homepage!
 
Old 11-19-2008, 08:02 PM Re: Script Request...
Extreme Talker

Posts: 201
witnesstheday brings up some good points... callous, but good.
Naturally, anytime you use del or rm, you are going to want to be extremely careful. Reading the man pages is GREAT advice! I highly recommend using the -i switch, as in
Code:
rm -i *\[*\]*
__________________
Bulbous Bouffant | NinjaSurf
CouponGuy is offline
Reply With Quote
View Public Profile
 
Old 11-20-2008, 01:04 PM Re: Script Request...
witnesstheday's Avatar
Alright my lads.

Posts: 390
Name: Shams Pirani
Location: London
Whereas I'm more an rm -f kind of person...

Occasionally, when deleting tonnes of things in folders of various sorts created by various userlevels, you get a prompt anyway, and rm -f gets it out the way.

Here for our new perl recruits is the relevant man page, to save the trouble...

Quote:
The options are as follows:

-d Attempt to remove directories as well as other types of
files.

-f Attempt to remove the files without prompting for confirma-
tion, regardless of the file's permissions. If the file does
not exist, do not display a diagnostic message or modify the
exit status to reflect an error. The -f option overrides any
previous -i options.

-i Request confirmation before attempting to remove each file,
regardless of the file's permissions, or whether or not the
standard input device is a terminal. The -i option overrides
any previous -f options.

-P Overwrite regular files before deleting them. Files are
overwritten three times, first with the byte pattern 0xff,
then 0x00, and then 0xff again, before they are deleted.

-R Attempt to remove the file hierarchy rooted in each file
argument. The -R option implies the -d option. If the -i
option is specified, the user is prompted for confirmation
before each directory's contents are processed (as well as
before the attempt is made to remove the directory). If the
user does not respond affirmatively, the file hierarchy
rooted in that directory is skipped.

-r Equivalent to -R.

-v Be verbose when deleting files, showing them as they are
removed.

-W Attempt to undelete the named files. Currently, this option
can only be used to recover files covered by whiteouts.
People in big companies pay 1000s of pounds to learn to use rm -f, I've discovered. The man pages are free, but these guys... they need someone with a certificate to tell them what's in a man page. They pay 2k for it. What a world.
witnesstheday is offline
Reply With Quote
View Public Profile Visit witnesstheday's homepage!
 
Old 11-20-2008, 01:05 PM Re: Script Request...
witnesstheday's Avatar
Alright my lads.

Posts: 390
Name: Shams Pirani
Location: London
that -W option is very interesting. What's a whiteout, I wonder. Commandline file recovery. Nice. Put away that norton. They're the ones who make the viruses anyway, and we all knows it.
witnesstheday is offline
Reply With Quote
View Public Profile Visit witnesstheday's homepage!
 
Old 11-21-2008, 04:41 PM Re: Script Request...
Extreme Talker

Posts: 201
Apparently, it works on union mounts only. Erasing a file on a union mount doesn't actually delete it on the bottom layer. Instead it adds an entry saying, "this file isn't here." Because the original file is still on the bottom layer, erasing the whiteout entry in the union mount makes the file appear again.

You're right, it IS interesting.
__________________
Bulbous Bouffant | NinjaSurf
CouponGuy is offline
Reply With Quote
View Public Profile
 
Old 11-22-2008, 05:42 AM Re: Script Request...
witnesstheday's Avatar
Alright my lads.

Posts: 390
Name: Shams Pirani
Location: London
That's a good thing to have. My research has led me here:
http://www.filesystems.org/project-unionfs.html

But I'm still far off from figuring out how to put it on my own systems.

My main one is redhat, and it's not on the list... maybe I can't have it on that system. My other is a really old macintosh (white semi-sphere type) with some old unix platform inside it.

From what I read, ubuntu is a good thing to embrace in these times, I guess. Maybe I'll get an empty box and ubuntu and play around.
witnesstheday is offline
Reply With Quote
View Public Profile Visit witnesstheday's homepage!
 
Reply     « Reply to Script Request...
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.14506 seconds with 12 queries