Upload rename_files.sh with huggingface_hub
Browse files- rename_files.sh +13 -0
rename_files.sh
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
for symlink in *; do
|
| 2 |
+
# Check if the entry is a symlink and is not a directory
|
| 3 |
+
if [ -L "$symlink" ] && [ ! -d "$symlink" ]; then
|
| 4 |
+
# Get the target of the symlink
|
| 5 |
+
target=$(readlink -f "$symlink")
|
| 6 |
+
|
| 7 |
+
# Extract the filename from the target path
|
| 8 |
+
filename=$(basename "$target")
|
| 9 |
+
|
| 10 |
+
# Rename the target file to match the symlink
|
| 11 |
+
mv "$target" "$symlink"
|
| 12 |
+
fi
|
| 13 |
+
done
|