I tried to learn more about Linux and this morning focused on the awk team. the command I tried to execute is below.
ls -lRt lpftp.* | awk '{print $7, $9}' | mkdir -p $(awk '{print $1}') | ls -lRt lpftp.* | cp $(awk '{print $9, $7}')
Essentially, I'm trying to move each file to a directory in a subdirectory based on the files of the last modified day. The command first prints only the files that I want, and then uses mkdir to create a folder depending on the day of the last change of the last month. What I want to do after this is move each file to its associated directory, however, since the command now moves each file to folder 01 and displays the following text
cp: 0653-436 12 is a directory.
Specify -r or -R to copy.
once for each directory.
Does anyone know how I can fix this problem? or if there is a better way to do this?
source
share