LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Blogs
User Name
Password

Notices


Old

New file name generator script/function, to avoid overwrites w/o user input

Posted 03-27-2016 at 07:11 PM by the dsc (linux-related notes)

Usage examples:

cp/mv/ln/etc file11.txt $(newname "/some/path/file11.txt")

cp/mv/ln/etc file11.txt $(newname "/some/path/whatever.txt")


If there's a file11.txt or whatever.txt already there, it will rename automatically to file11(1).txt or whatever(1).txt, and (N+1) from then on.

The whole path/name must be between quotes because of spaces and such things.

May be dangerous and somehow make you lose files...
Member
Posted in Uncategorized
Views 1141 Comments 0 the dsc is offline

  



All times are GMT -5. The time now is 10:39 AM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration