Questions tagged [file-manipulation]

199 questions
57
votes
2 answers

how to delete a file with R?

Possible Duplicate: Automatically Delete Files/Folders in R I would like to know if there is a way in R to check up if a file is in my current directory, and if it is there then the program deletes it? I know that other languages have direct…
Layla
  • 4,654
  • 14
  • 48
  • 64
14
votes
3 answers

Renaming files during ANT copy

I'd like to copy a directory of files, and rename some of them in the process. When I run the script below, nothing copies. If I comment the glob mappers in the file below, the files are copied (without the renaming) Thanks for any help. James
tarling
  • 1,557
  • 1
  • 14
  • 25
12
votes
2 answers

Replace nth line in a text file

How do I go about in replacing the nth line of a text file in R?
Simanner
  • 173
  • 1
  • 5
9
votes
6 answers

Keeping log files under a certain size

I have an application that is running on a stand-alone panel PC in a kiosk (C#/WPF). It performs some typical logging operations to a text file. The PC has some limited amount of disk space to store these logs as they grow. What I need to do is be…
BabaBooey
  • 1,512
  • 3
  • 21
  • 38
8
votes
3 answers

How to perform file / directory manipulation with user privileges in mind?

I have a server application that will be running under a system account because at any given time, it will be processing requests on behalf of any user on the system. These requests consist of instructions for manipulating the filesystem. Here's the…
Nathan Osman
  • 63,773
  • 66
  • 242
  • 344
7
votes
2 answers

How can I use impersonation to manipulate files/directories on a remote machine with UNC?

I need to download files from a server to a shared drive directory, creating the directory if it doesn't exist. There are a few things making this more complicated: I do not have write access (nor does the account that will run the job in UAT/Prod)…
Devsman
  • 382
  • 2
  • 14
7
votes
2 answers

Python: How to move a file with unicode filename to a unicode folder

I'm having hell with moving a unicode named file between unicode named folders in a Python script under Windows... What syntax would you use to find all files of type *.ext in a folder and move them to a relative location? Assume files and folders…
Jonathan
  • 84,911
  • 94
  • 244
  • 345
6
votes
1 answer

How to add extra meta data to PNG?

is there a way to add some extra metadata to a PNG file and then retrieve it with PHP ? like Comment field.
user529649
5
votes
3 answers

How to insert a line in a file between two blocks of known lines (if not already inserted previously), using bash?

I wrote a bash script which can modify php.ini according to my needs. Now I have to introduce a new change, and I cannot find a clear solution to it. I need to modify php.ini in order to insert (if not already inserted…
Luca Borrione
  • 15,077
  • 5
  • 48
  • 61
5
votes
1 answer

How can I copy files from folders and subfolders to another folder in R?

I would like to copy files only from 1 root folder that has 100's of folders and subfolders. I do not want to copy the folders. I just want to copy all the files (*.iso, *.txt, *.docx, *.pdf etc.) there are in these folders to another folder. My…
CuriousBeing
  • 1,442
  • 11
  • 31
4
votes
7 answers

Retrieving tail-end of a file path

I can't find an effective way to do this. The best way to describe what I'm trying to do is by example, so where we go (assuming /bar/ is the parent): C:\foo\bar\baz\text.txt will be my path. I'm interested in everything up to the top-level parent…
Dr.McNinja
  • 357
  • 1
  • 5
  • 13
4
votes
2 answers

Copy multiple files from multiple folders to a single folder using R

Hey I want to ask how to copy multiple files from multiple folders to a single folders using R language Assuming there are three folders: desktop/folder_A/task/sub_task/ desktop/folder_B/task/sub_task/ desktop/folder_C/task/sub_task/ In each of…
kelvinfrog
  • 373
  • 1
  • 6
  • 17
4
votes
1 answer

Limit of file size for truncate in R

From ?truncate: truncate truncates a file opened for writing at its current position. It works only for file connections, and is not implemented on all platforms: on others (including Windows) it will not work for large (> 2Gb) files. What is…
qed
  • 19,750
  • 16
  • 99
  • 168
4
votes
4 answers

Python newbie: trying to create a script that opens a file and replaces words

im trying to create a script that opens a file and replace every 'hola' with 'hello'. f=open("kk.txt","w") for line in f: if "hola" in line: line=line.replace('hola','hello') f.close() But im getting this error: Traceback (most recent…
ziiweb
  • 28,757
  • 70
  • 168
  • 290
4
votes
5 answers

How to read lines without iterating

I have a text file, and I have a condition set up where I need to extract a chunk of text every other line, but the chunk of text can be any amount of lines (a FASTA file, for any bioinformatics people). It's basically set up like this: > header,…
biohax2015
  • 241
  • 2
  • 5
  • 15
1
2 3
13 14