Remove dates from file names


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Remove dates from file names
# 1  
Old 07-13-2017
Remove dates from file names

Hi,

I'm using a shell script. I have extracted current date files to a directory1 and the date should be removed on both sides of a CSV file.

FYI... I'm looking to remove the date from the file name and not inside the CSV file.

Directory1

Code:
2017-07-12_gmr_tag_log_20170711.csv
2017-07-12_gmr_call_log_20170711.csv
2017-07-12_gmr_outgoing_log_20170711.csv

Final output Directory2:

Code:
gmr_tag_log.csv
gmr_call_log.csv
gmr_outgoing_log.csv

Moderator's Comments:
Mod Comment Opened a new thread for this question. Please do not hijack other threads but open your own in future..

Last edited by Scrutinizer; 07-13-2017 at 06:01 PM.. Reason: code tags
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remove trailing space from file and folder names

I have a folder that contains many sub folders and files. This tree has to be backed up to an archive system. According to the tech support, one of the archives is failing to back up due to the possibility of trailing spaces on file and folder names. Therefore, I would like to have a script... (16 Replies)
Discussion started by: vipertech
16 Replies

2. UNIX for Dummies Questions & Answers

How to remove first few characters from multiple file names without do loop?

Hi Fellows, I was wondering how I can remove first few characters from multiple file names without do loop in unix? e.g. water123.xyz water456.xyz to 123.xyz 456.xyz Thanks Paul Thanks. (3 Replies)
Discussion started by: Paul Moghadam
3 Replies

3. Linux

Get all the files from a FTP location with previous week's dates in the file names using Linux

I have a weird requirement where I have to get the files from a FTP(Lets say FTP1) location and place it on my current FTP(Lets say FTP2) location. The issue is, these are daily files (in a pattern Sales_YYYYMMDD_report.csv) and are placed every day on FTP1 and my process usually runs on Monday(eg.... (2 Replies)
Discussion started by: dhruuv369
2 Replies

4. Shell Programming and Scripting

Remove spaces from start of file names

Hi, I have a directory with the following file names 01 - abc hyn 02-def 03-ghi.dir 04 - jhu.dir abc1 kil def bil The last two file names abc1 starts with one space and def starts with double space. I want these files in my directory to be renamed as ABC HYN DEF GHI.dir... (6 Replies)
Discussion started by: jacobs.smith
6 Replies

5. Shell Programming and Scripting

How to get the dates from a list of file names?

Hi All, I have a .txt file with the list of filenames as given below. /dev_data/dev3/ctl/20120622_Employee.txt /dev_data/dev3/ctl/20120623_Employee.txt /dev_data/dev3/ctl/20120624_Employee.txt I want to read this file & write the dates alone from the filenames into a .done file. ... (6 Replies)
Discussion started by: dsfreddie
6 Replies

6. UNIX for Dummies Questions & Answers

Remove part of file names in a directory

Hi, i have a directory full of pictures, .jpg files. Half of them begin with "beach_" (for ex beach_123_123456.jpg) i'm looking for a command to remove the "beach_" from all files in the directory. thanks (4 Replies)
Discussion started by: robertmanalio
4 Replies

7. Shell Programming and Scripting

Remove special character ($) from file names

Hello I've searched here and on the 'net for examples of a script or command line function that will remove the $ character from all file names only that can be done within the directory that contains the file names - which are all html files. ie, I have a directory that contains html files... (6 Replies)
Discussion started by: competitions
6 Replies

8. Shell Programming and Scripting

Remove repeating pattern from beginning of file names.

I want a shell script that will traverse a file system starting at specific path. And look at all file names for repeating sequences of and remove them from the file name. The portion of the name that gets removed has to be a repeating sequence of the same characters. So the script would... (3 Replies)
Discussion started by: z399y
3 Replies

9. Shell Programming and Scripting

Remove spaces between file names

Hi All, I have spaces in between file names. "Material Header.txt" "Customer Header.txt" "Vendor Header.txt" And how can I remove spaces between file names like below MaterialHeader.txt CustomerHeader.txt VendorHeader.txt Thanks Srimitta (10 Replies)
Discussion started by: srimitta
10 Replies

10. Shell Programming and Scripting

how to remove files with only numbers as file names?

Hi all, I have a bunch of files that are named like 12543, 467249877, etc all over some directories.These files are named only with numbers, they dont have any letters or special characters in their file names. Could you please help me out and give me some command/script to remove only those... (6 Replies)
Discussion started by: praveen_indramo
6 Replies
Login or Register to Ask a Question