VectorLinux

Please login or register.

Login with username, password and session length
Advanced search  

News:

Visit our home page for VL info. For support and documentation, visit the Vector Linux Knowledge Center or search the Knowledge Center and this Forum using the search box above.

Author Topic: [SOLVED] batch renaming to .txt  (Read 794 times)

overthere

  • Vectorian
  • ****
  • Posts: 1333
[SOLVED] batch renaming to .txt
« on: December 21, 2012, 12:28:23 pm »

I had/have an issue where if I copied a document saved in leafpad to a floppy it copied as an executable.

 what I have been doing is saving these files with a name and not an extension assuming they were saved as .txt with a hidden extension. they open from /home by default in leafpad

 when I create a document in leafpad and save as "document.txt" it is copied to floppy as document.txt rather than document/executable.

now I have to figure out how to batch convert all the saved documents to .txt so they are able to be backed up as text files.

If I place all the named documents in a folder called documents is there a command or application to convert them all to- there names.txt?

or do I have to correct my error by renaming each file

Thanks for any
« Last Edit: December 21, 2012, 01:24:51 pm by overthere »
Logged
Everything Is Relative

M0E-lnx

  • Administrator
  • Vectorian
  • *****
  • Posts: 3217
Re: batch renaming to .txt
« Reply #1 on: December 21, 2012, 01:05:44 pm »

Looks like leafpad does not provide a default file extension, but you could easily rename them all to .txt.

Place them all in one directory
open a terminal a cd to that directory
then run this command
Code: [Select]
for i in *; do mv $i $i.txt; done

overthere

  • Vectorian
  • ****
  • Posts: 1333
Re: batch renaming to .txt
« Reply #2 on: December 21, 2012, 01:24:25 pm »

Thank you very much..this worked
 less two files which had a space in the name, I renamed them individually to complete the task.

Thank you
Logged
Everything Is Relative