Colon Cleaner
Here's a quick-and-dirty bash
snippet that recursively locates all files ending with the .npy
extension, and then replaces occurrences of a colon(:
) with a dash (-
) in their filename . For reference:
find ./ -depth -type f -name '*.npy' \
-exec bash -c 'mv "$0" "${0//:/-}"' {} \;
If you'd like, you could run the following to create a sandbox for testing:
#!/usr/bin/env bash
# Create time stamp
timestamp=$(date +"%H:%M:%S")
# Create three (3) dummy directories with two-hundred (200) files in each. A file will take this form:
dummy-data-000:20:12:00.npy
mkdir -pv data{0..2} && touch data{0..2}/dummy-data-{0..1}{0..9}{0..9}:"$timestamp".npy
Cheers.