Get file paste directory on Windows and Mac - windows

I'm trying to spy on the target directory when a user pastes a file. Let's say I copy/cut a file from somewhere on my computer. Then I paste it into another place. I want to be able to know the paste target directory programmatically.
Some questions on Stackoverflow mentioned using a global hook on Windows to be notified when a paste operation happens. But it doesn't give you the paste directory.
On Mac, file drag and drop has a promised delay feature. I'm not sure about normal file copy and paste.
Kind of get stuck now. Any suggestion would be appreciated.

Related

How to change a file's extension to something else?

I downloaded an .R file from a zoom chat on desktop to open in Rstudio later.
Well, the .R extension was not part of the name, so I changed the name to something.pdf (of course by mistake).
The icon now looks like a pdf. I replaced the .pdf with .R. But the icon still is a PDF file and Rstudio does not recognize it as an R file.
How can I can change it back to its .R format?
edit. thanks for pointing this out. I am on a windows 10 machine. and the file is on desktop.
Troubleshoot for Windows
You may be trying to add multiple file extensions, which does not allow the file to be ready correctly.
A quick google search.
How do I reveal file extensions?
For Windows 8-10
Start Windows Explorer, you can do this by opening up any folder.
Click the View menu.
Check the box next to "File name Extensions"
Then make sure you have my_file.R as opposed to my_file.R.R.pdf.

Pasted folder replaced old one without asking in windows

Was hard to describe my problem in Title. Basically I opened zip archive, and dragged a map out of it to desktop. Then I realized, that I had a map with the same name on desktop with different content and windows just replaced the old map with new one, without asking.
What I want to know is if there is any place I can find the old map, that got replaced? Can't really find it and the content was really important.
Any suggestions would be highly appreciated, because I myself have this situation for the first time and could not describe the problem to google.
So again, what I did:
Opened zip archive.
Dragged one folder on desktop
The folder replaced an existing folder on desktop, which apparently had the same name.
SOLVED
The solution was quite simple, but I will leave this post up, if anyone else gets this kind of problem, or by mistake clicked replace folder.
At least in windows 10, you can press properties of the new folder and there preview previous versions of the folder. Then click open and you can get the contents back. Or just click restore for restoring the folder to previous version.

Take multiple .zip files and extract them to external location

This is something that I thought would be extremely simple to do. A math teacher handles her notes through Dropbox and gets .zip files emailed to her containing updates (by updates- they're the full folders so she can delete the old and extract the new ones in their places). She asked if it was possible to extract the zip files, then copy them to the dropbox. Coming from a Linux/Mac point of view I thought it would be easy- unzip command with -d... Little did I know Windows doesn't support unzip. I've tried googling ways to do this, and found that windows doesn't seem to have a default 'unzip' command of any kind? And when trying to copy the files, wildcards don't work either??? She gets 7+ .zip files at a time, all are named "Unit (number).zip" So I was using Unit*.zip. Any help/ideas would be appreciated- I already suggested she tries ubuntu because she constantly states how she likes the way my laptop looks.
WinZip can quickly unzip multiple files through its drag and drop interface. You can select multiple WinZip files, right click, and drag them to a folder to unzip them all with one operation.
From an open folder window, highlight the WinZip files you want to Extract
Right click in the highlighted area and drag to the destination folder
Release the right mouse button
Choose WinZip Extract to here
To unzip multiple Zip files without drag and drop:
From an open folder window, highlight the WinZip files you want to Extract
Right click in the highlighted area
Choose WinZip Extract to ...
Enter the destination folder
Source http://kb.winzip.com/kb/entry/77/
You can easily use the GUI for this:
Here is a trick I have found for extracting multiple zips at once without installing any extra programs:
Select the zip files that you want to extract
Right-drag them to an empty space (in the same folder is fine)
Select Extract and follow the prompts
Yes, it is not quite as nice as using the command prompt, but it does get the job done.
Also, wildcards do work with command prompt. Perhaps you weren't issuing the command correctly. This command works fine for me:
copy Unit*.zip D:\folder2\

Force Firefox not to change file extension?

Is it possible to force Firefox not to change the file extension of a file the user downloads? Currently I have the problem that I have a .reg file to download, but Firefox, even though in the Download dialog it says "Text file (*.reg)", saves it as a .reg.txt file, which is highly annoying. How to fix this?
You could try to do the following things:
1.) https://support.mozilla.org/en-US/kb/change-firefox-behavior-when-open-file
Maybe extension (in your case .reg) is associated with Notepad and you could changed it in Options/Applications
a) Click the menu button and choose Options.
b) Select the Applications panel.
c) The Applications panel will display. Select the type of file for which you want to change the default action.
2.) https://bugzilla.mozilla.org/show_bug.cgi?id=511624
This is an old bug, but if you use the affected version of firefox...
When you right click on a link to a batch file and click save as, it will allow you to save it, but it automatically adds .txt to the end of the filename without informing you.
You are unable to save it as .bat
Reproducible: Always
Steps to Reproduce:
1.Right click on a batch file link
2.Click save as
3.Save it
Actual Results:
filename is file.bat.txt
Seems to be a Firefox on Windows bug. My coworker was implementing download of .reg files and I use Firefox, I tested for him and got a .reg.txt. Just renaming it after download was sufficient to make the .reg work, but I got curious if that would happen on Linux also.
Grabbed my laptop where I have Ubuntu installed and the file was downloaded with the correct extension (just didn't run because .reg is a windows extension, it did open in the text editor). It was not automatically renamed as a .txt.

Can I use Xcode as a simple text editor?

Okay ... This may be a ridiculous question. (I'm still getting used to Mac.) I really like the auto fill-in-ahead predictive typing feature of Xcode.
Can I use it to simply edit files laying around different locations on my hard drive? I do not really want to create a project or anything (unless by PROJECT I mean simply loads several files, that are not related to each other, but that I may want to jump back and forth in editing them - I do not want to create a project from files that need to be compiled or anything).
If so, what's the best way to get started? When you open XCode, it asked a lot of wizard questions to get things set up. How would I simply get started to edit 5 or so files at a time ... where I might want to switch back and forth between them - and they are not in the same directory?
All I want to do is simply make changes and save them, make more changes and save again, repeat. Kind of like holding a lot of shell scripts that communicate with each other.
Okay ... so I know this was a silly question - but Xcode is so intimidating for newbies. Sometimes, one needs a place to just get started and I haven't found that yet.
It is possible to open the Xcode text editor on a single file from the command line.
open -a Xcode.app filename.txt
If you're going to use this a lot, you might consider making an alias in your ~/.bashrc.
alias xc="open -a Xcode.app"
As of Xcode 6, you cannot open a directory this way, as it will give you an error message stating that directories must be opened as part of a project. If you provide more than one file on the command line, Xcode appears to create a temporary project containing the files you provided. You can add files and folders to the temporary project, but there doesn't seem to be a way to save the temp project for use later.
If you want to open a file in Xcode, you can also use xed.
As the man page says:
xed -- Xcode text editor invocation tool.
You can simply call xed [file] to launch Xcode editor.
Notepad++ is the way to go. Xcode was never meant to be used as a general text editor.
EDIT: Sorry, didn't know that there wasn't a Mac port for Notepad++. Use TextWrangler instead.

Resources