how can i remove the mystery .azdownload prefixed files - azure

I have a powershell script, in it calls azcopy to list, download then delete the files from azure blob, all runs good except there a few .azDownload+guid prefixed files show up.. now what i do with those files, it seeems some of them are legitimate files, just the prefix is the issue, how can i fix it?

found it, it appears azdownload was an interim file produced by azcopy, simply put in a delay script before downstream able to pick up solve the issue.. would it be better if azcopy can write the temp/interim file somewhere else to avoid confusion!

Related

Can not remove the file during unison sync

I have setup unison between Mac and Linux (both version 2.48.4) and sync-ing files is just fine. The problem is when I try to remove a file in one location, the file is not removed in the other location. Rather than that, the file is re-created in the original location I tried delete. This is happening in both Mac/Linux when I tried to delete there.
I used file-sync method for periodic sync and fsmonitor, and both have the same behavior. And, I know there is -nodeletion which prevents unison to remove the file, and I don't use this option at all. And at the moment, I have no clue why this is keep happening.
Do you have any suggestion to move forward?

Linux bash to compare two files but the second file must be find

I have a batch that integrates an xml file time to time but could happens daily. After it integrates it puts in a folder like /archives/YYMMDD(current day). The problem is if the same file is integrated twice. So I need a script what verifys the file (with diff command its possible but risky to make a bottleneck) but the problem is I can't find to resolve how to make to give the second files location.
P.S. I can't install on the server anything.
Thanks in advance.

AZCOPY downloading images asks for override

When I start copying all images from the container into an empty folder it asks if I wish to overwrite the file. Why this is happening? I have got /s argument specified to do recursive download. As I see it downloads into the right directory structure. File must be unique so this question should not be asked.
I use next command
AzCopy /Dest:C:\images /Source:https://*.blob.core.windows.net/images/ /SourceKey:a_key /s
Is it a bug or I do something wrong?
This is a known issue and there isn't anything to fix from AzCopy's side. Names of Windows file system is case insensitive, which is by design and can't be configured. To work around this issue, please rename one of your blob to avoid distinguishing blobs only by capitalization.

How to determine first run of an app/How to allow file delete in app folder

I have an old VB6 app that I'm distributing with the PDW. I need to determine after installation if it's the first run of the app. What's the simplest way to do this?
Currently, I install a dummy text file and use its existence as evidence of first run. If firstrun.txt is in the app directory, I open a subroutine that creates some directories and copies some files and then deletes the txt file. The next time, it skips the subroutine because firstrun.txt isn't there. Works perfect until users get an error code 70 because they don't have the appropriate permission to delete the file.
This is the code I'm using to delete the text file:
mobjFSO.DeleteFile App.Path & "\firstrun.txt
Anyone have a better way? Or could someone tell me how to allow the program to delete the file regardless of permisson?
Thanks in advance!
Try the opposite approach. If no file exists, assume it is the first run. After the first run does its thing, write a file -- but write it to a user area, such as C:\Users\myuser\AppData on Windows. This would be a more appropriate place to store this kind of data and you won't suffer the same permissions issues.

How can you tell what files are currently open by any user?

I am trying to write a script or a piece of code to archive files, but I do not want to archive anything that is currently open. I need to find a way to determine what files in a directory are open. I want to use either Perl or a shell script, but can try use other languages if needed. It will be in a Linux environment and I do not have the option to use lsof. I have also had inconsistant results with fuser. Thanks for any help.
I am trying to take log files in a directory and move them to another directory. If the files are open however, I do not want to do anything with them.
You are approaching the problem incorrectly. You wish to keep files from being modified underneath you while you are reading, and cannot do that without operating system support. The best that you can hope for in a multi-user system is to keep your archive metadata consistent.
For example, if you are creating the archive directory, make sure that the number of bytes stored in the archive matches the directory. You can checksum the file contents before and after reading the filesystem and compare that with what you wrote to the archive and perhaps flag it as "inconsistent".
What are you trying to accomplish?
Added in response to comment:
Look at logrotate to steal ideas about how to handle this consistently just have it do the work for you. If you are concerned that rename of files will make processes that are currently writing them will break things, take a look at man 2 rename:
rename() renames a file, moving it
between directories if required. Any
other hard links to the file (as
created using link(2)) are unaffected.
Open file descriptors for oldpath are
also unaffected.
If newpath already exists it will be atomically replaced (subject
to a few conditions; see ERRORS
below), so that there is no point at
which another process attempting to
access newpath will find it missing.
Try ls -l /proc/*/fd/* as root.
msw has answered the question correctly but if you want to file the list of open processes, the lsof command will give it to you.

Resources