#!/bin/bash
# リネーム対象のディレクトリ
target_dir="/Users/username/Downloads/notion/dir"
# target_dir以下のディレクトリを検索
find "$target_dir" -type d -print0 -mindepth 1 | while IFS= read -r -d '' dir; do
#for dir in $(find "$target_dir" -type d -mindepth 1 -print0); do
# 削除後のディレクトリ名を作成(拡張子を残す)
new_dir="${dir:0:${#dir}-33}"
# リネームを実行
echo -e "${dir} to ${new_dir}"
mv "$dir" "$new_dir"
done
# target_dir以下のファイルを検索
find "$target_dir" -type f -print0 -mindepth 1 | while IFS= read -r -d '' file; do
# 削除後のファイル名を作成(拡張子を残す)
new_file="${file:0:${#file}-36}.md"
# リネームを実行
#mv "$file" "$new_file"
echo -e "${file} to ${new_file}"
mv "$file" "$new_file"
done
https://forum.obsidian.md/t/notion-2-obsidian-migration-instructions/2728