You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			20 lines
		
	
	
		
			443 B
		
	
	
	
		
			Bash
		
	
			
		
		
	
	
			20 lines
		
	
	
		
			443 B
		
	
	
	
		
			Bash
		
	
#!/usr/bin/env bash
 | 
						|
 | 
						|
function datemv {
 | 
						|
    if [[ $(basename "$1") == $(stat -c "%y" "$1" | cut -d " " -f1)* ]]; then
 | 
						|
        echo "Do nothing with '$1'"
 | 
						|
    else
 | 
						|
        mv -v "$1" "$(dirname "$1")/$(stat -c "%y" "$1" | cut -d " " -f1)_$(basename "$1")"
 | 
						|
    fi
 | 
						|
}
 | 
						|
 | 
						|
if [ -d $1 ]; then
 | 
						|
    for file in $(find "$1" -type f | grep -vP "\/\d{4}-\d{2}-\d{2}"); do
 | 
						|
        datemv "$file"
 | 
						|
    done
 | 
						|
else
 | 
						|
    echo "Directory not found '$1'"
 | 
						|
    exit
 | 
						|
fi
 | 
						|
 |