473,385 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Changing many file names at once

424 256MB
I have a number of files each named differently but all ending in ".dat". I'd like to swap the ".dat" for ".csv". I could write a batch script which iterates through the ".dat" files, renaming each one, but is there an easier way to do this?
Aug 20 '08 #1
4 2173
Nepomuk
3,112 Expert 2GB
Well, I don't know about you, but I use Xfce as a Desktop Environment and I only have to mark all of the file I want to rename, right click on them, choose "Change name" and then I can select "Replace ... with ..." for all of them. I guess that other Environments (meaning Gnome and KDE) have similar capabilities. Maybe just try doing it like I do, it might work. ^^

Greetings,
Nepomuk
Aug 20 '08 #2
If you check the repositories there are lots of programs which are made for renaming large quantities of files.

Edward
Aug 20 '08 #3
arnaudk
424 256MB
Unfortunately, I'm working through a ssh terminal, but I'll keep the gui tip in mind. It would be nice if I could just use core utils and do it on one line, but at the moment I'm just using this small script.
Expand|Select|Wrap|Line Numbers
  1. #!/bin/csh
  2.  
  3. foreach fname (`ls *.dat`)
  4.   cp $fname `echo $fname | sed 's/.dat/.csv/g'`
  5. end
  6.  
Aug 20 '08 #4
Working through ssh terminal should not stop you from installing or running a program which will rename files. If you use the '-X' flag with ssh then it will tunnel graphics (so if you run a program with a gui the gui will appear on the computer infront of you). As for installing a program, every package manager I know of has terminal commands (but since I don't know what linux system you are using I can't say what command to use).

Edward
Aug 20 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

15
by: oom | last post by:
I am a bit of a newbie when it comes to python, when working with lists today I noticed some very odd behaviour, any suggestions welcome: Python 2.2.3 (#1, Nov 6 2003, 14:12:38) on linux2...
2
by: Satish Kumar Chimakurthi | last post by:
Hi all, An external solver program is dynamically producing files with different names 0000001.dat, 0000002.dat, 0000003.dat etc.....at regular intervals. These files contain all numeric data....
21
by: Blue Ocean | last post by:
Forgive me for asking so many questions so quickly. I am simply asking as they come up unanswered in my book. Can you change namespaces half way through a file? For instance, if you want to...
5
by: John Pass | last post by:
I saved a project accepting the defaults name “ConsoleApplication2”. After adding the code, I changed the name using “Rename” in the file directory. After opening the file, the project name...
4
by: andychambers2002 | last post by:
I'm working on a "TempFile" class that stores the data in memory until it gets larger than a specified threshold (as per PEP 42). Whilst trying to implement it, I've come across some strange...
0
by: Steave | last post by:
Hi, using Managed C++ (.Net 2.0), I want to embed some images within an executable using a .resX file, and upon an event (in this case a combo box changing), I want the picture box to update with a...
4
by: Tugrul HELVACI | last post by:
Changing DisplayNames of my properties using PropertyGrid component, how ?? I'm using Delphi 2006 and I have a class defination like this: TPerson = class fPersonName : String;...
4
by: Jay | last post by:
What's the recommended way to change file/folder names within a project? I want to change the solution name from (say) sol1.sln to sol2.sln, and also everything else named sol1.* (eg sol1.suo,...
10
by: 7stud | last post by:
Hi, I'm experimenting with a basic socket program(from a book), and both the client and server programs are on my computer. In both programs, I call socket.gethostname(), but I discovered that...
7
by: franc sutherland | last post by:
Hi everyone, I am using Access 2003. I have a database with a table in it which is linked to an excel spreadsheet. When I install the database on someone else's system, the pathname to the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.