[colug-432] help with a command

Chris Embree cembree at ez-as.net
Sun Aug 10 15:07:49 EDT 2014


Not according the the test case I just ran.

 mkdir test
for x in {a..z}; do mkdir test/$x; for z in {a..w}; do touch
test/${x}/${z}.PA; touch test/${x}/${z}.keep; done; done
touch keep.PA
find test/ -type f -name "*.PA" -delete
 ls *.PA
keep.PA

Feel free to verify the contents before and after.  Works for me.



On Sun, Aug 10, 2014 at 2:37 PM, Rick Hornsby <richardjhornsby at gmail.com>
wrote:

>
> On Aug 10, 2014, at 13:34, Chris Embree <cembree at ez-as.net> wrote:
>
> This should work:  find /top/dir/to/search/ -type f -name "*.PA" -delete
>
>
> That will delete everything at the current directory as well.
>
>
>
>
> On Sun, Aug 10, 2014 at 2:25 PM, Stephen Potter <spp at unixsa.net> wrote:
>
>>  How about "rm *.PA/*"
>>
>> -spp
>>
>>
>>
>> On 8/10/2014 1:53 PM, Keith Larson wrote:
>>
>>  I am searching for a way to empty the contents of a bunch of folders
>> without removing the folders themselves AND leave other files at the
>> currect directory level alone.
>>
>> I have a bunch of print queue folders.
>>
>> du -shc *.PA
>>
>> shows these results
>>
>> 199M 4A81C53F.PA <http://4a81c53f.pa/>
>> 941K 4A81D556.PA <http://4a81d556.pa/>
>> 0 4A81D56D.PA <http://4a81d56d.pa/>
>> 192K 4A81D582.PA <http://4a81d582.pa/>
>> 632K 4A81D598.PA <http://4a81d598.pa/>
>> 0 4A81D5AD.PA <http://4a81d5ad.pa/>
>> 254M 4A81D5C0.PA <http://4a81d5c0.pa/>
>> 0 4A81DF1B.PA <http://4a81df1b.pa/>
>> 0 4A81DF45.PA <http://4a81df45.pa/>
>>
>> All folders have a .PA extension so they are easily identified.
>>
>> You can see that some are empty and some have files (print jobs) in
>> them.  I want to delete all files from WITHIN these folders and nothing
>> else.
>>
>> Can someone help with a single command that will do this?
>>
>>
>>
>>
>>
>> _______________________________________________
>> colug-432 mailing listcolug-432 at colug.nethttp://lists.colug.net/mailman/listinfo/colug-432
>>
>>
>>
>> _______________________________________________
>> colug-432 mailing list
>> colug-432 at colug.net
>> http://lists.colug.net/mailman/listinfo/colug-432
>>
>>
> _______________________________________________
> colug-432 mailing list
> colug-432 at colug.net
> http://lists.colug.net/mailman/listinfo/colug-432
>
>
>
> _______________________________________________
> colug-432 mailing list
> colug-432 at colug.net
> http://lists.colug.net/mailman/listinfo/colug-432
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.colug.net/pipermail/colug-432/attachments/20140810/4960ec33/attachment.html 


More information about the colug-432 mailing list