Batch Dating?
#1
Hi all,

I'm looking for an app. or bash script that will date multiple folders chronologically. E.g:

Folder 1 named January contains 31 sub folders each named e.g:

1-1-14
2-1-14
3-1-14 etc.

I need the app. or script to be able to rename sub folders in the folder 2 February from e.g.:

1-1-14, 2-1-14 etc to 1-2-14, 2-2-14 and so on.

Thanks in advance,
Reply
#2
Very rough cut. Untested.
Do keep a backup of your data before trying the script. Smile

Suggest:
unmask the "#echo $n"
mask (#) the mv line

Run the script
Do you see directory names as you want ? If so proceed with the line containing 'mv'

$cat rename.sh
Code:
#!/bin/bash

# accept input of the new month (2=Feb,3=Mar...)
m=$1

# For each sub-folder...
for i in `ls -d */ | cut -f1 -d'/'`
do

# .. get the date and year from the sub-folder name
d=`echo $i | cut -d\- -f1`
y=`echo $i | cut -d\- -f3`

# Compose new directory name to be date-new_month-year
n="$d-$m-$y"

# echo test
#echo $n

# do the rename
mv $I $n
done

Usage:
====
$ pwd
/home/nelly

$ ls rename.sh
rename.sh

$ cd Feb

// cd to Feb folder, run the script and finally remove the extra dates (29,30,31) manually
$ ../rename.sh 2

// next, cd to March folder and type
$ ../rename.sh 3

and so on till December.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Online Dating Mastery - Evolve Social Dating Fitain556 0 7,807 Oct 25, 2021, 23:58 pm
Last Post: Fitain556
  Online Dating Coaching Program - Stephen Grosch Fitain556 0 8,296 Oct 25, 2021, 23:53 pm
Last Post: Fitain556
  Dating Courses Request player077 1 12,345 Apr 13, 2021, 13:18 pm
Last Post: jyotir
  Dating programs and courses abhi0009726 0 11,806 Apr 25, 2018, 06:16 am
Last Post: abhi0009726
  Self-help videos: The Mature Men's Dating Program by Barron Cruz nate 0 11,670 Apr 08, 2018, 19:08 pm
Last Post: nate



Users browsing this thread: 1 Guest(s)