file-move

PHP: move with rename fails, but combination of copy and unlink works

走远了吗. 提交于 2019-12-23 01:19:12
问题 I am trying to use PHP's rename to move a file to a different folder (and also rename the file in the same step). However, rename always returns false . On the other hand, using a combination of copy and unlink works just fine. What could be causing this? The relevant code looks like this: if (!rename($targetpath, $backuppath)) { // if rename fails, try with copy and delete if (!copy($targetpath, $backuppath)) die("9\nCould not move existing file to backup"); touch($backuppath, filemtime(

Moving files from one subdirectory to another

假如想象 提交于 2019-12-12 03:26:56
问题 I tried moving files from one directory to another and didn't work. so I searched and found an answer that fits what I want. When I run it, modified to my directory, it gives What is want to do: ${filename,,*} : bad substitution! This is what I used: for filename in *; do case "${filename,,*}" in b01.nii*) mv "$filename" "$/Users/dave/Desktop/test/untitled_folder_*/str" ;; vol_01.nii*) mv "$filename" "$/Users/dave/Desktop/test/untitled_folder_*/rs" ;; *) echo "don't know where to put

Move files up one folder level

爱⌒轻易说出口 提交于 2019-11-28 02:17:38
I have a folder called "April reports" that contains a folder for each day of the month. Each folder then contains another folder which contains PDF files: April reports ├─01-04-2018 │ └─dayreports │ ├─approved.pdf │ └─unapproved.pdf │ ├─02-04-2018 │ └─dayreports │ ├─approved.pdf │ └─unapproved.pdf ╎ ╎ └─30-04-2018 └─dayreports ├─approved.pdf └─unapproved.pdf The PDFs have the same name for each day so the first thing I want to do is move them up one level so that I can use the folder name containing the date to rename each file so that it will contain the date. The script I have tried is this

Move files up one folder level

眉间皱痕 提交于 2019-11-26 22:09:49
问题 I have a folder called "April reports" that contains a folder for each day of the month. Each folder then contains another folder which contains PDF files: April reports ├─01-04-2018 │ └─dayreports │ ├─approved.pdf │ └─unapproved.pdf │ ├─02-04-2018 │ └─dayreports │ ├─approved.pdf │ └─unapproved.pdf ╎ ╎ └─30-04-2018 └─dayreports ├─approved.pdf └─unapproved.pdf The PDFs have the same name for each day so the first thing I want to do is move them up one level so that I can use the folder name