[kwlug-disc] Need some advice/assistance on a script
Khalid Baheyeldin
kb at 2bits.com
Tue Jun 18 13:42:45 EDT 2013
That takes the prize. Thanks for the -empty option ...
On Tue, Jun 18, 2013 at 1:39 PM, Chris Irwin <chris at chrisirwin.ca> wrote:
> Why all the extra effort of writing a script, when a single find command
> would suffice? That way you're not passing file names between processes, or
> building lists, and avoid having to remember quotes in too many places, or
> set IFS, etc.
>
> $ find /path/to/source/files/ -type f -exec mv '{}'
> /path/to/destination/ \;
>
> If you're not sure if that is safe yet, throw an echo into the command:
>
> $ find /path/to/source/files/ -type f -exec echo mv '{}'
> /path/to/destination/ \;
>
> Remove empty directories when complete:
>
> $ find /path/to/source/files -type d -empty -delete
>
>
>
> On Tue, Jun 18, 2013 at 11:55 AM, R. Brent Clements <rbclemen at gmail.com>wrote:
>
>> I need to do something dramatically destructive. I want to take a large
>> directory tree of folders, and collapse them all down to their root
>> folder. File collisions are irrelevant. How would you guys do this?
>> (assume for the moment that you would).
>>
>> _______________________________________________
>> kwlug-disc mailing list
>> kwlug-disc at kwlug.org
>> http://kwlug.org/mailman/listinfo/kwlug-disc_kwlug.org
>>
>>
>
>
> --
> Chris Irwin
> <chris at chrisirwin.ca>
>
> _______________________________________________
> kwlug-disc mailing list
> kwlug-disc at kwlug.org
> http://kwlug.org/mailman/listinfo/kwlug-disc_kwlug.org
>
>
--
Khalid M. Baheyeldin
2bits.com, Inc.
Fast Reliable Drupal
Drupal optimization, development, customization and consulting.
Simplicity is prerequisite for reliability. -- Edsger W.Dijkstra
Simplicity is the ultimate sophistication. -- Leonardo da Vinci
For every complex problem, there is an answer that is clear, simple, and
wrong." -- H.L. Mencken
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://kwlug.org/pipermail/kwlug-disc_kwlug.org/attachments/20130618/63973292/attachment.htm>
More information about the kwlug-disc
mailing list