<p>You shouldn't delete them while featureCounts is running, it's creating read-name-sorted temporary files so it can more easily look at both mates together. Just wait for it to finish running and it will clean up the files itself. Doing so beforehand is liable to cause an error.</p>

CC BY-SA 4.0
2018-05-07T08:33:54.593Z
Thanks. But will there be any memory problem for those temp files? Asking this cz right now I have only 60 samples, for those samples I removed temp files manually. It didn't clean up even after finishing the job. I have to use featureCounts on at least 900 samples in future.
beginner
CC BY-SA 4.0
2018-05-07T08:53:25.697Z
There aren't memory issues involved, though I suppose you could run into temporary space constraints. If featureCounts didn't clean up after itself then I encourage you to check and ensure it didn't encounter an error. I have never had it leave temp files around otherwise.
Devon Ryan
CC BY-SA 4.0
2018-05-07T08:21:06.017Z
2018-05-07T08:21:06.017Z
Devon Ryan
<p>I used this command for extracting read counts for almost 60 samples using featureCounts.</p>

<pre><code>featureCounts -a /gencode.v27.primary_assembly.annotation_nochr.gtf -F GTF -p -s 2 -T 8 -o counts.txt sample.sorted.bam
</code></pre>

<p>I see many "temp-core-100373-A4BF0116E148.sam-TH00-BK004414.tmp" files like this dumped in my directory. I'm able to delete them only manually. Is there a way to get rid of these tmp files from my directory while using the command?</p>

<rna-seq><sam><rna><reads><gtf>
How to get rid of the temp files while using "featureCounts" for extracting readcounts from bam files?
# How to get rid of the temp files while using "featureCounts" for extracting readcounts from bam files?

(Asked by: username_0 on 2018-05-07)

I used this command for extracting read counts for almost 60 samples using featureCounts.
featureCounts -a /gencode.v27.primary_assembly.annotation_nochr.gtf -F GTF -p -s 2 -T 8 -o counts.txt sample.sorted.bam

I see many "temp-core-100373-A4BF0116E148.sam-TH00-BK004414.tmp" files like this dumped in my directory. I'm able to delete them only manually. Is there a way to get rid of these tmp files from my directory while using the command?

**Tags:** rna-seq, sam, rna, reads, gtf

---

## 1 answers

### Answer by username_1 on 2018-05-07. Score: 2

You shouldn't delete them while featureCounts is running, it's creating read-name-sorted temporary files so it can more easily look at both mates together. Just wait for it to finish running and it will clean up the files itself. Doing so beforehand is liable to cause an error.

> **Comments:**
> **username_0**: Thanks. But will there be any memory problem for those temp files? Asking this cz right now I have only 60 samples, for those samples I removed temp files manually. It didn't clean up even after finishing the job. I have to use featureCounts on at least 900 samples in future.  
> **username_1**: There aren't memory issues involved, though I suppose you could run into temporary space constraints. If featureCounts didn't clean up after itself then I encourage you to check and ensure it didn't encounter an error. I have never had it leave temp files around otherwise.  

---

