Is rename() without fsync() safe?

No. Look at libeatmydata, and this presentation: Eat My Data: How Everybody Gets File IO Wrong http://www.oscon.com/oscon2008/public/schedule/detail/3172 by Stewart Smith from MySql. In case it is offline/no longer available, I keep a copy of it: The video here The presentation slides (online version of slides)

Get the Perl rename utility instead of the built-in rename [closed]

I can only speak for Debian. The two programs are called /usr/bin/rename.ul from the util-linux package (hence the .ul suffix) /usr/bin/prename from the perl package The actual rename command works via the /etc/alternatives mechanism, whereby /usr/bin/rename is a symlink to /etc/alternatives/rename /etc/alternatives/rename is a symlink to /usr/bin/prename The same problem has been bugging me on … Read more

Batch rename sequential files by padding with zeroes

Python import os path=”/path/to/files/” for filename in os.listdir(path): prefix, num = filename[:-4].split(‘_’) num = num.zfill(4) new_filename = prefix + “_” + num + “.png” os.rename(os.path.join(path, filename), os.path.join(path, new_filename)) you could compile a list of valid filenames assuming that all files that start with “output_” and end with “.png” are valid files: l = [(x, “output” … Read more

Linux zip command: add a file with different name [closed]

You can use zipnote which should come with the zip package. First build the zip archive with the myfile.txt file: zip archive.zip myfile.txt Then rename myfile.txt inside the zip archive with: printf “@ myfile.txt\n@=myfile2.txt\n” | zipnote -w archive.zip (Thanks to Jens for suggesting printf instead of echo -e.) A short explanation of “@ myfile.txt\n@=myfile2.txt\n”: From … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)