Copy Files To Dev Null Productions
 admin
Copy Files To Dev Null Productions 8,6/10 8654 reviews
Active5 years, 4 months ago
/dev/null is just a file, it's a 'special character' file but it's non the less still bound by the rules that files must follow. That being said you could never run this command: The mv command won't allow this since you're moving a directory to a file, that just doesn't make sense contextually and mv knows this. The log will grow indefinitely unless system accounting is running. System accounting clears it out nightly. The /var/adm/wtmp file can be cleared out or edited to remove old and unwanted information. To clear it, use the following command: cp /dev/null /var/adm/wtmp.
If I want to ignore stdout
of a command, I do this on *nix:
How do I achieve the same on Windows (in cmd
or a batch file)?
15.7k5 gold badges46 silver badges61 bronze badges
Sridhar RatnakumarSridhar Ratnakumar2,1618 gold badges35 silver badges52 bronze badges
1 Answer
John TJohn T147k22 gold badges305 silver badges335 bronze badges
Not the answer you're looking for? Browse other questions tagged windowscommand-lineunixbatchredirection or ask your own question.
Copy Files To Dev Null Productions Download
Rclone copy with transfer limit
#!/bin/bash |
# Edit me |
rclone_bin='/rclone/rclone' |
rclone_options='--config=/rclone/rclone.conf --buffer-size 500M --checkers 16' |
rclone_cloud_endpoint='gd:' |
local_dir='/documents' |
limit_gb=750 |
################################################################################ |
if pidof -o %PPID -x '$(basename '$0')';then |
echo'[ $(date +%F@%T) ] Upload already in progress. Aborting.' |
exit 3 |
fi |
today_gb=$limit_gb |
# Generate filelist and iterate through it... |
find '${local_dir}' -type f |
whileread -r n;do |
# Find the pathname relative to the root of your remote and store filename |
filename='$(echo '$n' sed -e s@'${local_dir}'@@)' |
destpath='$(dirname '$n' sed -e s@'${local_dir}'@@)' |
# Skip hidden or partial files. |
case'$n'in |
(*.partial~) continue ;; |
(*_HIDDEN~) continue ;; |
(*.QTFS) continue ;; |
(*.fuse*) continue ;; |
(.DS_STORE) continue ;; |
esac |
fileSize=$(du -sb '$n' awk '{print $1}') |
fileSizeGb=$(($fileSize/1000/1000/1000)) |
today_gb=$(($today_gb-$fileSizeGb)) |
if [ '$today_gb'-le'0' ];then |
echo'Transferred $(($limit_gb-$fileSizeGb)) GB today. Waiting 24 hours' |
sleep 24h |
today_gb=$limit_gb |
fi |
# If file is opened by another process, wait until it isn't. |
while [ '$(lsof '$n'>/dev/null 2>&1)' ] |
[ '$(lsof '${local_dir}/${n}'>/dev/null 2>&1)' ];do |
echo'[ $(date +%F@%T) ] File -> ${n} in use. Retrying in 10 seconds.' |
sleep 10 |
done |
# Copy file to remote destination[s], retaining path |
echo'[ $(date +%F@%T) ] Transfering file -> ${n} to ${rclone_cloud_endpoint} in ${destpath}.' |
'${rclone_bin}' copy $rclone_options'$n''${rclone_cloud_endpoint}${destpath}'>/dev/null 2>&1 |
done |
# success! |
exit 02 |
Copy Files To Dev Null Productions Free
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment