bulletmark / edir

Program to rename, remove, and copy files and directories using your editor
139 stars 8 forks source link

when copying, subdirectories are not created #22

Closed balta2ar closed 4 months ago

balta2ar commented 4 months ago

my usecase was to copy some of the files located in various subdirs into a single root subdir, e.g.

1  ./2/b.txt
2  ./1/a.txt

after editing

1  ./2/b.txt
2  ./1/a.txt
1  ./tmp/2/b.txt
2  ./tmp/1/a.txt

I get

Copy "2/b.txt" to "tmp/2/b.txt" ERROR: [Errno 2] No such file or directory: 'tmp/2/b.txt'
Copy "1/a.txt" to "tmp/1/a.txt" ERROR: [Errno 2] No such file or directory: 'tmp/1/a.txt'
balta2ar commented 4 months ago

It is possible to work around it with 2 invocations though:

  1. first by adding a prefix to the filenames -- i.e. using copy that doesn't require creation of new dirs
  2. then by removing prefix and adding a root prefix subdir -- rename works fine if it needs to create a new directory

but it would have been be more convenient if copy could create the whole path

bulletmark commented 4 months ago

Fixed by commit c0108a7f5ef3ddb3f1a8bf6f74c770f95d48b2ac.