diff --git a/README.md b/README.md index 9bb6ec4..9550b4f 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ Subsequently running the program will check for updates and download any new epi To sync podcasts to a Rockbox iPod, simply run ``` -podcast-hoarder +podcast-hoarder sync ``` replacing `` with the root directory of the iPod. This will generate playlists for all podcasts, sync the playlists to the iPod, and sync the episodes to the iPod. diff --git a/src/sync.rs b/src/sync.rs index 6840b4c..4d61f56 100644 --- a/src/sync.rs +++ b/src/sync.rs @@ -162,7 +162,10 @@ pub(crate) fn sync( if !target.exists() { println!("[info] copying from {:?} to {:?}.", source, target); - fs::create_dir_all(target.parent().unwrap())?; + let parent = target.parent().unwrap(); + if !parent.exists() { + fs::create_dir_all(parent)?; + } fs::copy(source, target)?; } }