I am using file handles to write my datasets to file in spss, which worked fine the first time.
FILE HANDLE directoryPath /NAME='D:\XX\Dropbox\XX\' .
FILE HANDLE write_data /NAME='directoryPath/dataset_1.sav' .
SAVE OUTFILE='write_data '
Now I get the following error:
>Error # 5332 in column 26. Text: write_data
>The specified file or directory is read-only and cannot be written to. The
>file will not be saved. Save the file with another name or to a different
>location or change the access permissions first.
>Execution of this command stops.
If I specify the full path rather than the file handle:
SAVE OUTFILE='D:\XX\Dropbox\XX\dataset_1.sav'
/COMPRESSED.
It works fine. As you can see, i am writing to a dropbox folder. I am not sure if this interferes with the permissions. Is there anyone that knows how to make my file handle example work by changing overall permissions, or do I need to revert back to changing my syntax manually?
File handles are not cumulative. Only the first portion can be interpreted as a file handle.
Related
I'm getting the following error:
"The file isn’t compatible with QuickTime Player."
When using this script:
tell application "Finder"
set random_file to some file of entire contents of folder "Movies" of home
open result
end tell
However, I am able to open the file from the finder manually and once I do the script works on just that file. The problem is I have thousands of files and don't want to open each one manually for the script to work again. Have not had this problem with the script in the past.
There are two ways I can think of to approach modifying your script:
Stick with Finder's open command but invoke it fully with its using parameter, which accepts an application file that informs Finder of the application that will be used to open the file. It may sound superfluous given it already tries to open it in QuickTime, and we're not trying to change that, but it's not unwise to see if it does confer a difference in behaviour:
tell application id "com.apple.finder"
tell the folder (path to movies folder) to tell (the ¬
a reference to entire contents) to tell (the ¬
some document file as alias) to set f to it
open f using application file id "com.apple.QuickTimePlayerX"
end tell
Grab the file as you like (really, you ought to be using System Events for this, not Finder, but I'll go with what you had), but then use the open handler of the specific application to open the file:
tell application id "com.apple.finder" to tell the folder (path to movies folder) ¬
to tell (a reference to the entire contents) to tell (some document file) ¬
as alias to set f to it
tell application id "com.apple.QuickTimePlayerX"
activate
open f
end tell
NB. I'm using Monterey, in which both of these two above propositions work appropriately. This doesn't necessarily infer that it will do so in Big Sur, but if they do not, it's worth checking the various app permissions under the different Security & Privacy headings of System Preferences.
i want to move a file from a directory to anther directory with C Coding.
I search and find rename(); function , but when working it doesnt work and have a error:
my code:
#include <stdio.h>
int main() {
if(rename("/root/tmpfile.php", "/home/check-tmp.php"))
perror( NULL );
}
the code well compiled but when running this code showing this error:
Invalid cross-device link
How to move a file from a directory to anther directory without using System for fopen?
Aslo , i finded many codes and ways to do it but doesnt working all codes.
Please say me a way and make sure it will work
Thanks.
Many aspects of the behavior of `rename' are inherently platform-dependent: The rename operation might not be able to move a file from one file system to another , it might not be atomic, and it might not succeed if a file with the destination abstract pathname already exists.
In other words, your system does not support rename files cross different partitions (your root partition and your home partition are different.)
So the solution is when it fails, copy the file to the destination and delete the original.
The rename call can only rename and move files within a single disk partition. The error "cross-device link" indicates that you attempted to move a file from one partition to another. (If you were on a Windows system, you can imagine if you tried to rename a file from C: to D:.)
When you use the Unix mv command to move files, it first tries a rename, but if it fails in this way, it falls back and makes a new copy of the file in the new location, then deletes the original. That's what you would have to have your code do in this situation, too.
(Copying a file is easy enough, but there are plenty of library functions out there that will do it for you, and also take care of things like preserving the last-modified time and other file attributes.)
I have to read a file in my shell script. I was using PL/SQL's UTL_FILE to open the file.
But I have to do a new change which will append timestamp to the file.
e.g import.data file becomes import_20152005101200.data
Now timestamp is the time at which file arrive at the server.
Since the file name changed I can't use the old way of file accessing.
I came up with below solution:
UTL_FILE.FOPEN ('path','import_${file_date}.data','r');
To achieve this I have to get filename and trim it using SUBSTR to get timestamp and pass to file_date variable.
However I am not able to find how to access filename in a particular path. I can use basename. But My file name keeps changing because of timestamp.
Any help/ alternate ideas are welcome.
PL/SQL isn't a good tool to solve this problem; UTL_FILE doesn't have any tools to list all the files in a folder.
A better solution is to define a stored procedure which uses UTL_FILE and pass the file name to process as an argument to the procedure. That way, you use the shell (which has many powerful commands and tools to examine folders and files) or a script language like Python to determine which file to process.
I have a seriously weird problem, and I suspect it has something to do with the length of the filename - but I cannot alter it (for now).
I'm trying to copy a file from a network share to the users local %temp% with a logon script. The reason for this, is that each user needs to have an individual copy of the file when opening it so that the next users doesn't get a "file is locked" message.
If I run the command manually in a CMD window, the file gets copied, but if I place it in a login.bat-file on the domains netlogon-folder and tries to run the bat-file, I get "The system cannot find the path specified."
This is the actually command:
COPY /Y "\\SERVER\Felles\Administrasjon\Customer KS-manual\Kvalitetshåndbok\2000 org. kart\2 0 B 01-14 Customer Name Arbeids-Prosess-flyt_NO.odg" %TEMP%\Kvalitetshaandbok.odg
So as I said - if I type that in CMD, the file gets copied. If I place it in \customer.local\NETLOGON\login.bat and run the BAT-file, I get "The system cannot find the path specified."
I also tried earlier to just open the file, and that only worked if I opened \customer.local\NETLOGON\shortcut.lnk and shortcut.lnk pointed to the UNC-path of the file. The problem is that I cannot copy a file using a shortcut.lnk AFAIK.
My main object is to have each user get a unique copy of the file and opened on logon.
Is the problem isolated to the length, or is there something else I miss out on?
Try "%TEMP%\Kvalitetshaandbok.odg" with the double quotes because the username can contain spaces etc, which trickles down to the %temp% path.
There are also non-latin characters in the path and the code page being used may need to be altered to match the character set.
I am trying to add a file into ClearCase, but I am getting the following error:
Error adding 'C:\PATH\file.dbc' to source control.
Changed Protection on "C:\PATH\file.dbc".
Created branch "C:\PATH\file.dbc" version "\main\0".
Type manager "text_file_delta" failed create_version operation.
Checked the following:
There are lines that have over 8000 characters and they must stay that way, so it can not use the "text_file_delta" as the type manager. I changed the type of one file to "compressed_file" and I was able to check it in.
I tried to add dbc compressed_file -name "*.[dD][bB][cC]" ; to the default.magic file. Then, I tried to check it with ct file test.dbc and it said that it is a compressed_file, but when I try to add an actual .dbc file to source control, it still gives me the error about the "text_file_delta" failing.
Is there something that I am missing with this? Maybe I put the line in the wrong part of the default.magic file?
Note: the only default.magic file that I am able to find is on the server side, is this correct? (I would rather it check here instead of everyone having to make one on their client.)
Make sure the default.magic file is taken into account, and is in the right directory, as mentioned in "About the ClearCase Magic file".
Make sure you did add the new rule in the right place in that magic file: see "How file types are determined when creating a new element"
Note: This is the first section in the default.magic file.
Example:
# Match by name without examining data
core file : -name "core" ;
compressed_file : -name "*.[nN][eE][wW]";
Note: The new file-typing rule that you add must come before the following line in the magic file:
text_file : -printable ;
compressed_file : !-printable ;
Use a personal magic file rather than modifying the default one:
Caution: It is highly recommended that you not modify the default.magic file directly as the next time an upgrade is performed, a new default.magic file will be created and your changes will be lost.
Creating a personal magic file with a name that is alphabetically before the "d" in the default.magic file name (such as cc.magic) will allow ClearCase to parse this file before the default.
It is better to create a personal magic file and possibly setting the MAGIC_PATH variable instead.