[NTLUG:Discuss] What's the bash equiv of the DOS for % in?
Michael Patrick
michael at techiesplace.com
Sun Aug 26 00:28:06 CDT 2001
Given: Directory A is polluted by improper untarring. Directory B contains the contents of the tarball.
I think you will find the following of use:
cd directoryb ; for x in *; do rm -rf directorya/$x; done
This got both files and subdirectories in my testing.
Michael
On Sat, Aug 25, 2001 at 11:04:28PM -0500, Richard Geoffrion wrote:
> DOS: for %i in (*.*) do del ..\%i
>
> English: For every instance of a file specified by the wildcard do command
> using that file
>
> I don't want to delete every file in that subdirectory...just the files that
> I extracted. So...if I sit in a directory that contains JUST the files that
> came out of the tar and I issue the above DOS command...only I need the
> LINUX version of it... I can automatically clean the files out of the
> trashed up directory.
>
> *note. If you use that command in a DOS batch file, you need to use double
> percent signs.
More information about the Discuss
mailing list