Windows incorrectly copying files by filename when in a Special Folder - windows

If I copy a file from a special folder to the clipboard, change the location that special folder points to, and try to paste the file to this new location, Windows complains with a Item Not Found error, seemingly trying to copy the file by the filename alone.
The way I change the special folder location is with this line of C++ code:
SHSetKnownFolderPath(FOLDERID_Desktop, 0, NULL, new_location);
And a refresh to see the effect immediately:
SHChangeNotify(0x8000000, 0x1000, NULL, NULL);
Steps to reproduce
Desktop pointing to C:\Users\BoppreH\Desktop
Copy the file music 1.mp3 from the Desktop (C:\Users\BoppreH\Desktop\music 1.mp3)
Change location of the Desktop special folder to D:\music
The Desktop now shows the musics from D:\music
Try to paste music 1.mp3 on the Desktop
It fails with Item Not Found, complaining it could not find the file at D:\music\music 1.mp3, when the file is still happily sitting at C:\Users\BoppreH\Desktop\music 1.mp3. If I paste the file in any other folder that is not the Desktop, it works fine.
I know this is a case of Doctor, it hurts when I do this, and that constantly changing the location of the Desktop is extremely unusual behavior, but this is a feature I've grown to love and this bug constantly bites me.
Is there some workaround for this issue?

Use some type of folder watcher control to detect when the Special Folders location has changed and check the clipboard for any file paths that refer to the old location and update them.
Or change the location of the Specials before you copy the file.

Related

Only FileSnoop can see my Win10 NTFS data file. Why?

On a Win10 laptop, I have an application that writes data files to the C: root directory (DL900WIN, which is a home alarm security GUI). The PC Magazine utility FileSnoop v1.1.0.0 can see it and confirms the name, size, file/date and attribute "A". The filenames is "201207backup-DL900.DL1"
The Win10 File Explorer cannot see this file, even with "Hidden items" checked.
The Win10 CL dir does not show this file, with or without the /ah option.
The Win10 WSLinux does not show this file, even with the -a option.
If DL900WIN writes the file to a folder instead of C: root directory, then it is visible as a normal file should be. I can operate this way, but now I cannot delete the files in the C: root directory, so I'd like to learn.
What file system mechanism exists to hide a file in the root directory so that only FileSnoop (and DL900WIN) can see it? How can I access such a file with normal OS tools?

Recovering lost documents from cmd moving

I was messing with the move command in Command Prompt, and I accidentally moved a file into a folder that didn't exist. When I tried 'dir', the invalid folder was listed, but it wasn't a directory, and it didn't show up under 'tree'. If I renamed the file as a .zip, it had folders within like _rels, docProps, and word, as well as [Content_Types].xml. Each folder contained several more xml files, but none had the document I had just misplaced. Is there a way to get it back or have I lost it permanently?
Ok, so basically what happend is that you tried to zip the .docx document, and then you got all of these folders. It simply what happens when you zip a word document.
There's nothing strange, you can just make it .docx again and it will be as normal.

rsync with AppleScript, copy from other volume

I'm trying to build a automatic backup solution. My AppleScript commands are pretty simple. All I want to do is copy all the files in one folder to a different folder.
Currently I'm using this:
rsync --update -raz --progress Documents/test "Volumes/RFM_Projects_2"
This works when I have my files located in a folder called test in the Documents folder. Problem is that I have a different folder structure now where I have all the files I want to copy on a second internal harddrive.
I thought it would be easy to just change "Documents/test" to something like "Volumes/WORK/test", but this does not work at all.
Any ideas about how I can change the source location to a secondary harddrive?
All slash-delimited style paths, like the ones used in your rsync command, must start with a slash (/). That slash stands for the startup volume drive. I do not see that first slash in any of your paths so I'm surprised any of your code ever worked. Here's an applescript which will show you the path. Run this, select any folder you want, and copy/paste the result into your code. Note that if there are any spaces in any of your paths then you should put your paths in quotes in your rsync command.
choose folder
return POSIX path of result
Also note if you want the path to a file instead of a folder then change the word folder to file in the applescript. Good luck.

Where does it create the 7zip compressed files

I am using "7-zip 9.20" on "Windows 7".
If I compress a file in my "C" drive (ex: c:\myFolder ), using 7-zip, the output will be creating somewhere else. At this time, I cant find it even with a windows file search.
Does anyone know, where the default location and how can I change it...?
Finally I found the default location. This may be useful for some other as well.
C:\Users{user_name}\AppData\Local\VirtualStore
For anyone with this issue still using Windows 7, but updated to 7-Zip version of 16.04.
If you select the folder to archive >> Tools >> Options >> Folders tab, it will show the options for the Working Folder: System temp folder, current, or Specified, the last of which allows you to designate a path directory for every time you compress the file.
I thought the default was to the folder containing the files you try to archive.
When you select "Add to archive" there is a ... button beside the Archive name, where you can browse to the location you require.

How to find parent ZIP file from arguments when double-clicking in Windows Explorer - .NET 4.0

In Windows Explorer, when you open a ZIP file and double-click a file, say a JPEG file (.jpg), Windows extracts the JPEG file to a temporary folder, and passes the temporary file name to the associated program as the one and only argument, such as "C:\Users\jprice\AppData\Local\Temp\Temp1_<>.zip\<>.jpg"
I noticed that some applications, like the Windows Photo Viewer in Windows 7 know what ZIP file the temporary file came from. You can click next and previous and get the next/previous files from the ZIP file (as you do, they are also extracted to temporary files).
I've googled and prowled through system.io.packaging, but I can't figure out how to get the path of the original ZIP file (the file name is part of the temporary file path).
It's not done with the shell-->open command, Windows Photo Viewer only gets the temporary file name as far as I can tell.
The Photo Viewer command line is
%SystemRoot%\System32\rundll32.exe "%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll", ImageView_Fullscreen %1
Which doesn't help. I did use ProcessMon to watch Photo Viewer and saw it read the .zip file (probably using zipfldr.dll) but could not discover how it knew where the original zip file was.
When I try it, I notice that WinZip initializes the spawned process's current working directory to the folder that the .zip resides in. If you can extract the .zip filename from the temp file path (and older OS versions did not do that), then you can reconstruct the original .zip file path.

Resources