How to intentionally break rar archive (make it unreadable)? - windows

I want to intentionally break rar archive for testing purposes.
I was trying to copy archive in the middle or archiving process but it is impossible due to read lock (I use windows 7).
How to do that?

I think opening with editor and deleting some chunks of the gibberish code should work. However, there would still be trouble with the read-lock.
I tested it with a .zip file. After the first delete (first ~10 lines) it was still readable by 7-Zip, after deleting some more lines it was corrupted and Windows Explorer nor 7-Zip was able to open it.

Related

Can we open Robocopy Log while copy is in progress?

I started using robocopy with /Z switch and log option. I started copying 109+ GB file , it is more than two days and still getting copied. Since I ran copy with log option (/LOG+) , I cannot see percentage of completion. Is it safe to open log , while copy is in progress to see percentage of completion. Do not want file copy interrupted by opening log file. Is it safe to copy the log file to a different location and open it. Can some one clarify me on this?
Whether or not it is possible to open it, depends on the program you're using for that matter: programs like Notepad and Notepad++ are able to open a file, while another process is still writing to it, MS-Word is not able to do that. The largest difference between Notepad and Notepad++ for this matter is that Notepad can't refresh the file (or reload from disk, as it is called in Notepad++).
In case you have a Linux subsystem on your PC, you might use the tail -f feature, which is written especially for this purpose.

FileZilla won't upload properly

I recently installed WordPress on my hosting server and all went fine, however one of my pages "/wp-admin/update-core.php" is having issues. Upon opening, the file appears to be cut off mid way.
I've compared this file against the file in the zip file I uploaded and the original copy is not truncated.
Where this gets even weirder is that, if I edit the file on the server to paste in the missing code, after I save and open again, the file is still missing the code I just added AND is now missing an additional line of code.
I've also tried deleting the file, and re-uploading the original copy again and it appears to be cutting off at the same point.
Anyone experienced this or have any ideas?
I've got a similar problem with v3.37.3 - uploaded .zip file is truncated, and .svg files have zero length. This is true even when I set the transfer type to 'binary' rather than 'auto'. Also, when repeating the copy operation for the .zip file, I am prompted more than once to confirm the overwrite of th eexisting file, almost as though Filezilla sees several files instead of just the one .zip archive.
I had the same problem. I uploaded a file (a Linux executable) and it was truncated from 4,396,728 bytes to 4,392,145 bytes. My fix was to change the transfer type, which you can set using the Transfer menu, from Auto to Binary. I guess that FileZilla assumes that files with no extension are text; other files, with extensions dmg (Apple disk image) and zip (compressed file) were correctly treated as binary. I am using a very recent version of FileZilla: 3.29.0.

Merging PDFs skipping corrupted PDFs

Currently I am using Ghostscript to merge a list of PDFs which are downloaded. The issue is if any 1 of the pdf is corrupted, it stops the merging of the rest of the pdfs.
Is there any command which i must use so that it will skip the corrupted pdfs and merge the others?
I have also tested with pdftk but facing the same issue.
Or is there any other command line based pdf merging utility that I can use for this?
You could try MuPDF, you could also try using MUPDF 'clean' to repair files before you try merging them. However if the PDF file is so badly corrupted that Ghostscript can't even repair it that probably won't work either.
There is no facility to ignore PDF files which are so badly corrupted they can't even be repaired. Its hard to see how this could work in the current scheme, since Ghostscript doesn't 'merge' files anyway, it interprets them, creating a brand new PDF file from the sequence of graphic operations. When a file is badly enough corrupted to provoke an error we abort because we may have already written any parts of the file we could, and if we tried to ignore and continue both the interpreter and the output PDF file would be in an indeterminate state.

Prevent the access from copying a file when other resources are using it

In my application, i have one exe file that will do some conversion on my videofiles in a directory, and also i have used cute ftp to transfer the files present in the directory to another server.
CUTE FTP is configured to be run on every mins.
When 25% of job is over for a video file, CUTEFTP is transferred that file to other server.
What are the ways to fix this problem.
Process the file in a different directory and then move it to a place where CUTE FTP will pick it up after the conversion is finished.
[EDIT] Don't use copy, use move. Both directories must be on the same harddisk. When using the Windows Explorer, use "Cut" or just drag the file with the mouse. Make sure there is no little "[+]" when you drop it.

Renaming A Running Process' File Image On Windows

I have a Windows service application on Vista SP1 and I've found that users are renaming its executable file (while it's running) and then rebooting, thus causing it to fail to start on next bootup because the service manager can no longer find the exe file since it's been renamed.
I seem to recall that with older versions of Windows you couldn't do this because the OS placed a lock on the file. Even with Vista SP1 I still cannot copy over the existing file when it's running - Windows reports that the file is in use - makes sense. So why should I be allowed to rename it? What happens if Windows needs to page in a new code page from the exe but the file has been renamed since it was started? I ran Process Monitor while renaming the exe file, etc, but Process Mon didn't report anything strange and just logged changing the filename like any other file.
Does anyone know what's going on here behind the scenes? It's seem counter intuitive that Windows would allow a running process' filename (or its dependent DLLs) to be changed. What am I missing here?
your concept is wrong ... the filename is not the center of the file-io universe ... the handle to the open file is. the file is not moved to a different section of disk when you rename it, it's still in the same place and the part of the disk the internal data structure for the open file is still pointing to the same place. bottom line is that your observations are correct. you can rename a running program without causing problems. you can create a new file with the same name as the running program once you've renamed it. this is actually useful behavior if you want to update software while the software is running.
As long as the file is still there, Windows can still read from it - it's the underlying file that matters, not its name.
I can happily rename running executables on my XP machine.
The OS keeps an open handle to the .exe file,. Renaming the file simply changes some filesystem metadata about the file, without invalidating open handles. So when the OS goes to page in more code, it just uses the file handle it already has open.
Replacing the file (writing over its contents) is another matter entirely, and I'm guessing the OS opens with the FILE_SHARE_WRITE flag unset, so no other processes can write to the .exe file.
Might be a stupid question but, why do users have access to rename the file if they are not suppose to rename the file? But yeah, it's allowed because, as the good answers point out, the open handle to the file isn't lost until the application exits. And there are some uses for it as well, even though I'm not convinced updating an application by renaming its file is a good practice.
You might consider having your service listen to changes to the directory that your service is installed in. If it detects a rename, then it could rename itself back to what it's supposed to be.
There are two aspects to the notion of file here:
The data on the disk - that's the actual file.
The file-name (could be several or none) which you can give that data - called directory entries.
What you are renaming is the directory entry, which still references the same data. Windows doesn't care about your doing so, as it still can access the data when it needs to. The running process is mapped to the data, not the name.

Resources