I know its a big classical but I didn't found the exact situation that concerns me
I need a mkdir
+mv
command that can be invoked like that :
mvdir /home/user/Documents/irs.pdf /mnt/work/45/223/insight/irs1970.pdf
Exactly like a normal mv
command works, just with a creation of path instead of a no such file or directory
Considering that work/45/223/insight/
doesn't exist and need to be created
All other command that I've found can't be invoked like that, needs some more informations, need to distinguish the path and file ourself, or something
Attempt: mkdir -p /mnt/work/45/223/insight && mv /home/user/Documents/irs.pdf /mnt/work/45/223/insight/irs1970.pdf
mkdir -p /mnt/work/45/223/insight && mv /home/user/Documents/irs.pdf /mnt/work/45/223/insight/irs1970.pdf
– aaa Nov 27 '22 at 10:56/mnt/work/45
exists, in which case creating the whole name again will fail. Checkman mkdir
for the-p
option. Also consider defining a function in your .profile when you have tested your commands: better than either an alias or a script. – Paul_Pedant Nov 27 '22 at 10:59mkdir
command who can just complete the missing path, who not fail too. My command doesn't work as is because it's two commands. I need one that make the work, who distinguish himself the path and the filename, likemv
, just with a creation of path instead of an error. Sure I will consider to write in hard the function when I will find one that fulfill the need – aaa Nov 27 '22 at 11:13